66 lines
1.2 KiB
C
Executable File
66 lines
1.2 KiB
C
Executable File
#include <gint/display.h>
|
|
#include <gint/keyboard.h>
|
|
#include <gint/timer.h>
|
|
|
|
#include "world.h"
|
|
#include "mario.h"
|
|
#include "level.h"
|
|
|
|
#include <gint/exc.h>
|
|
#include <gint/keyboard.h>
|
|
#include <gint/defs/attributes.h>
|
|
#include <gint/clock.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();
|
|
}
|
|
|
|
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);
|
|
}
|
|
|