2023-03-17 09:50:44 +01:00
|
|
|
#include "lzy.h"
|
2023-03-17 10:51:17 +01:00
|
|
|
#include "game.h"
|
|
|
|
#include "player.h"
|
2023-03-17 11:33:08 +01:00
|
|
|
#include "background.h"
|
2023-03-17 13:45:20 +01:00
|
|
|
#include "cfg.h"
|
2023-03-17 16:38:10 +01:00
|
|
|
#include "input.h"
|
2023-03-17 10:51:17 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2023-03-17 09:50:44 +01:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2023-03-21 22:24:24 +01:00
|
|
|
if (LZY_Init("hyperultra!", 30, "res/tset.png", "res/font.png")) {
|
2023-03-17 10:20:30 +01:00
|
|
|
LZY_Log("LZY_Init failed: %s", LZY_GetError());
|
|
|
|
LZY_Quit();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2023-03-17 10:51:17 +01:00
|
|
|
Game *const game = malloc(sizeof(Game));
|
|
|
|
if (game == NULL) {
|
|
|
|
LZY_Log("malloc failed");
|
|
|
|
LZY_Quit();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
game_init(game);
|
|
|
|
|
2023-03-17 10:20:30 +01:00
|
|
|
while (!LZY_ShouldQuit()) {
|
|
|
|
LZY_CycleEvents();
|
2023-03-17 16:38:10 +01:00
|
|
|
input_update();
|
2023-03-17 10:57:19 +01:00
|
|
|
game_update(game);
|
2023-03-19 05:49:14 +01:00
|
|
|
background_update(game);
|
2023-03-17 10:20:30 +01:00
|
|
|
|
|
|
|
LZY_DrawBegin();
|
2023-03-17 13:45:20 +01:00
|
|
|
LZY_DrawSetColor(WHITE);
|
2023-03-17 10:20:30 +01:00
|
|
|
LZY_DrawClear();
|
2023-03-17 10:57:19 +01:00
|
|
|
game_draw(game);
|
2023-03-21 22:19:31 +01:00
|
|
|
background_draw();
|
2023-03-17 10:20:30 +01:00
|
|
|
LZY_DrawEnd();
|
|
|
|
}
|
|
|
|
|
2023-03-17 10:51:17 +01:00
|
|
|
game_deinit(game);
|
|
|
|
free(game);
|
2023-03-17 10:20:30 +01:00
|
|
|
LZY_Quit();
|
|
|
|
return 0;
|
2023-03-17 09:50:44 +01:00
|
|
|
}
|