define for FPS, set to 50
This commit is contained in:
parent
b36693a16c
commit
9a01ec8b6b
|
@ -2,3 +2,4 @@
|
|||
#define PLAYER_W 11
|
||||
#define LEVEL_WIDTH 28
|
||||
#define LAST_LEVEL 5062
|
||||
#define FPS 50
|
||||
|
|
|
@ -122,7 +122,7 @@ void erase_tile(int x, int y, char level[])
|
|||
|
||||
void draw_timer(unsigned int step)
|
||||
{
|
||||
dprint(0, 0, C_WHITE, C_BLACK, "%u.%02u", step/60, step%60);
|
||||
dprint(0, 0, C_WHITE, C_BLACK, "%u.%02u", step/FPS, step%FPS);
|
||||
}
|
||||
|
||||
void just_breathe(unsigned int step)
|
||||
|
@ -135,7 +135,7 @@ void just_breathe(unsigned int step)
|
|||
{
|
||||
dclear(0);
|
||||
dtext(x, y, "Thank you for playing", C_WHITE, C_BLACK);
|
||||
dprint(x, y + 12, C_WHITE, C_BLACK, "%u.%02u", step/60, step%60);
|
||||
dprint(x, y + 12, C_WHITE, C_BLACK, "%u.%02u", step/FPS, step%FPS);
|
||||
dupdate();
|
||||
x += xspd;
|
||||
y += yspd;
|
||||
|
|
|
@ -64,7 +64,7 @@ int main(void)
|
|||
player_x = start_x;
|
||||
player_y = start_y;
|
||||
//fps cap timer
|
||||
timer_setup(0, timer_delay(0, 16667), 0, callback, &has_ticked);
|
||||
timer_setup(0, timer_delay(0, 1000000/FPS), 0, callback, &has_ticked);
|
||||
timer_start(0);
|
||||
while (game_loop) {
|
||||
while(!has_ticked) sleep();
|
||||
|
|
Loading…
Reference in New Issue