supercasiobros/src/main.c

52 lines
950 B
C
Raw Normal View History

2019-11-16 11:44:09 +01:00
#include <gint/display.h>
#include <gint/keyboard.h>
#include <gint/timer.h>
2019-11-16 12:02:30 +01:00
#include "world.h"
2019-11-20 15:33:34 +01:00
#include "mario.h"
2019-11-16 12:02:30 +01:00
2019-11-20 18:31:20 +01:00
#include <gint/exc.h>
#include <gint/keyboard.h>
#include <gint/defs/attributes.h>
extern image_t img_error;
GNORETURN void system_error(uint32_t code)
{
timer_stop(0);
dimage(0,0,&img_error);
dupdate();
while(1) getkey();
}
2019-11-16 11:44:09 +01:00
int callback(volatile void *arg)
{
volatile int *has_ticked = arg;
*has_ticked = 1;
return 0;
}
int main(void)
{
2019-11-20 18:31:20 +01:00
gint_panic_set(system_error);
2019-11-16 11:44:09 +01:00
volatile int has_ticked = 1;
timer_setup(0, timer_delay(0, 50000), timer_Po_4, callback, &has_ticked);
2019-11-16 11:44:09 +01:00
timer_start(0);
2019-11-20 15:33:34 +01:00
while(global_quit==0)
2019-11-16 11:44:09 +01:00
{
if (has_ticked)
{
has_ticked=0;
mario_move();
dclear(C_WHITE);
2019-11-16 11:44:09 +01:00
world_draw(mario.p.x,mario.p.y);
//ennemies_draw();
mario_draw();
//ingame_draw();
dupdate();
}
2019-11-16 11:44:09 +01:00
}
timer_stop(0);
}