interference/src/main.c

58 lines
689 B
C
Raw Normal View History

2021-12-22 16:18:06 +01:00
#include "main.h"
2022-01-14 21:52:46 +01:00
#include "bullet.h"
2021-12-22 16:18:06 +01:00
#include "draw.h"
2022-01-08 19:19:02 +01:00
#include "hook.h"
2021-12-22 16:18:06 +01:00
#include "input.h"
2021-12-23 15:13:06 +01:00
#include "level.h"
2021-12-22 16:18:06 +01:00
#include "player.h"
static int running = 1;
2022-01-12 16:43:22 +01:00
static int timer = 0;
2021-12-22 16:18:06 +01:00
static void init(void);
static void update(void);
static void draw(void);
int
main(void)
{
init();
while (running) {
update();
draw();
if (input_pressed(K_EXIT)) {
running = 0;
}
}
return 1;
}
static void
init(void)
{
input_init();
2021-12-23 15:13:06 +01:00
level_init();
2022-01-14 21:52:46 +01:00
bullet_table_init();
2021-12-22 16:18:06 +01:00
}
static void
update(void)
{
input_step();
player_update();
2022-01-14 21:52:46 +01:00
bullet_table_update();
2022-01-12 16:43:22 +01:00
++timer;
2021-12-22 16:18:06 +01:00
}
static void
draw(void)
{
2022-01-08 15:24:23 +01:00
dclear(C_BLACK);
2021-12-23 15:13:06 +01:00
level_draw();
2022-01-12 16:43:22 +01:00
player_draw(timer);
2022-01-14 21:52:46 +01:00
bullet_table_draw(timer);
2021-12-22 16:18:06 +01:00
dupdate();
}