Yeti::draw(DrawingContext& context)
{
// we blink when we are safe
- if(safe_timer.started() && size_t(global_time*40)%2)
+ if(safe_timer.started() && size_t(game_time*40)%2)
return;
BadGuy::draw(context);
static const float elapsed_time = 1.0 / LOGICAL_FPS;
// old code... float elapsed_time = float(ticks - lastticks) / 1000.;
if(!game_pause)
- global_time += elapsed_time;
+ game_time += elapsed_time;
// regulate fps
ticks = SDL_GetTicks();
context.draw_text(white_text, _("TIME's UP"), Vector(SCREEN_WIDTH/2, 0),
CENTER_ALLIGN, LAYER_FOREGROUND1);
} else if (time_left.get_timeleft() > TIME_WARNING
- || int(global_time * 2.5) % 2) {
+ || int(game_time * 2.5) % 2) {
snprintf(str, sizeof(str), " %d", int(time_left.get_timeleft()));
context.draw_text(white_text, _("TIME"),
Vector(SCREEN_WIDTH/2, 0), CENTER_ALLIGN, LAYER_FOREGROUND1);
get_pos(), layer);
}
}
- else if (safe_timer.started() && size_t(global_time*40)%2)
+ else if (safe_timer.started() && size_t(game_time*40)%2)
; // don't draw Tux
else
tux_body->draw(context, get_pos(), layer);
// Draw blinking star overlay
if (invincible_timer.started() &&
(invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING
- || size_t(global_time*20)%2)
+ || size_t(game_time*20)%2)
&& !dying)
{
if (!is_big() || duck)
/**
* WARNING: This file is automatically generated from:
- * 'src/scripting/wrapper.interface.h'
+ * 'src/scripting/wrapper.interface.hpp'
* DO NOT CHANGE
*/
#ifndef __supertux_WRAPPER_H__
Tile::draw(DrawingContext& context, const Vector& pos, int layer) const
{
if(images.size() > 1) {
- size_t frame = size_t(global_time * anim_fps) % images.size();
+ size_t frame = size_t(game_time * anim_fps) % images.size();
context.draw_surface(images[frame], pos, layer);
} else if (images.size() == 1) {
context.draw_surface(images[0], pos, layer);
#include <math.h>
#include "timer.hpp"
-float global_time = 0;
+float game_time = 0;
Timer::Timer()
: period(0), cycle_start(0), cyclic(false)
{
this->period = period;
this->cyclic = cyclic;
- cycle_start = global_time;
+ cycle_start = game_time;
}
bool
if(period == 0)
return false;
- if(global_time - cycle_start >= period) {
+ if(game_time - cycle_start >= period) {
if(cyclic) {
- cycle_start = global_time - fmodf(global_time - cycle_start, period);
+ cycle_start = game_time - fmodf(game_time - cycle_start, period);
} else {
period = 0;
}
#ifndef __SUPERTUX_TIMER_H__
#define __SUPERTUX_TIMER_H__
-extern float global_time;
+extern float game_time;
/**
* new simpler timer designed to be used in the update functions of objects
float get_period() const
{ return period; }
float get_timeleft() const
- { return period - (global_time - cycle_start); }
+ { return period - (game_time - cycle_start); }
float get_timegone() const
- { return global_time - cycle_start; }
+ { return game_time - cycle_start; }
bool started() const
{ return period != 0 && get_timeleft() > 0; }
// Calculate the movement-factor
Uint32 ticks = SDL_GetTicks();
float elapsed_time = float(ticks - lastticks) / 1000.;
- global_time += elapsed_time;
+ game_time += elapsed_time;
lastticks = ticks;
// 40fps is minimum
if(elapsed_time > .04)
while(!quit) {
Uint32 ticks = SDL_GetTicks();
float elapsed_time = float(ticks - lastticks) / 1000;
- global_time += elapsed_time;
+ game_time += elapsed_time;
lastticks = ticks;
// 40 fps minimum // TODO use same code as in GameSession here
p != function->parameters.end(); ++p) {
if(i == 0 && p->type.atomic_type == HSQUIRRELVMType::instance()) {
out << ind << "HSQUIRRELVM arg0 = v;\n";
- arg_offset++;
+ arg_offset--;
} else {
char argname[64];
snprintf(argname, sizeof(argname), "arg%d", i);