diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 60 |
1 files changed, 27 insertions, 33 deletions
@@ -1,50 +1,44 @@ #include "conf.h" +#include "input.h" +#include "level.h" #include "lzy.h" +#include "player.h" -int main(int argc, const char **argv) -{ - int x = 0; - int y = 0; +static void deinit(void); - if (LZY_Init(argc, argv, "wehfou official goty", 30, "res/tset.png", - "res/font.png")) { +int main(int argc, char **argv) +{ + if (LZY_Init(argc, (const char **)argv, "wehfou official goty", 30, + "res/tset.png", "res/font.png")) { LZY_Log(LZY_GetError()); - LZY_Quit(); + deinit(); return 1; } + level_load(0); + player_init(0, 0); + while (!LZY_ShouldQuit()) { - /* update */ LZY_CycleEvents(); + input_update(); + player_update(); - if (LZY_KeyDown(LZYK_LEFT)) - x -= 2; - if (LZY_KeyDown(LZYK_RIGHT)) - x += 2; - if (LZY_KeyDown(LZYK_UP)) - y -= 2; - if (LZY_KeyDown(LZYK_DOWN)) - y += 2; - - /* draw */ LZY_DrawBegin(); - { - /* draw background */ - LZY_DrawTileEx(0, 0, 0, 13, 7); - LZY_DrawTileEx(0, DISPLAY_WIDTH / 2, 0, 13, 7); - LZY_DrawTileEx(0, 0, DISPLAY_HEIGHT / 2, 13, 7); - LZY_DrawTileEx(0, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, - 13, 7); - - /* draw player */ - if (LZY_DrawChar('s', x, y)) - LZY_Log(LZY_GetError()); - } + LZY_DrawTileEx(TSET_LINE, 0, 0, 13, 7); + LZY_DrawTileEx(TSET_LINE, DISPLAY_WIDTH / 2, 0, 13, 7); + LZY_DrawTileEx(TSET_LINE, 0, DISPLAY_HEIGHT / 2, 13, 7); + LZY_DrawTileEx(TSET_LINE, DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, + 13, 7); + player_draw(); LZY_DrawEnd(); } - LZY_Log("cya"); - LZY_Quit(); - + deinit(); return 0; } + +static void deinit(void) +{ + level_deinit(); + LZY_Quit(); +} |