hyperultra/src/main.c

44 lines
734 B
C

#include "lzy.h"
#include "game.h"
#include "player.h"
#include "background.h"
#include "cfg.h"
#include "input.h"
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
if (LZY_Init("Hyperultra!", 30, "res/tset.png", "res/font.png")) {
LZY_Log("LZY_Init failed: %s", LZY_GetError());
LZY_Quit();
return 1;
}
Game *const game = malloc(sizeof(Game));
if (game == NULL) {
LZY_Log("malloc failed");
LZY_Quit();
return 1;
}
game_init(game);
while (!LZY_ShouldQuit()) {
LZY_CycleEvents();
input_update();
game_update(game);
LZY_DrawBegin();
LZY_DrawSetColor(WHITE);
LZY_DrawClear();
background_draw();
game_draw(game);
LZY_DrawEnd();
}
game_deinit(game);
free(game);
LZY_Quit();
return 0;
}