#include #include #include #include "world.h" #include "mario.h" #include "level.h" #include #include #include #include extern image_t img_error; GNORETURN void system_error(uint32_t code) { timer_stop(0); dimage(0,0,&img_error); dupdate(); while(1) getkey(); } int callback(volatile void *arg) { volatile int *has_ticked = arg; *has_ticked = 1; return 0; } int main(void) { gint_panic_set(system_error); volatile int has_ticked = 1; timer_setup(0, timer_delay(0, 50000), timer_Po_4, callback, &has_ticked); timer_start(0); set_level(0); int current_level=0; while(global_quit==0) { if (has_ticked) { has_ticked=0; mario_move(); dclear(C_WHITE); world_draw(mario.p.x,mario.p.y); //ennemies_draw(); //ingame_draw(); dupdate(); if (mario_dead) { set_level(current_level); mario_dead=0; } } else sleep_ms(3,1); } timer_stop(0); }