diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..acd2aba --- /dev/null +++ b/src/main.c @@ -0,0 +1,50 @@ +#include "conf.h" +#include "lzy.h" + +int main(int argc, const char **argv) +{ + int x = 0; + int y = 0; + + if (LZY_Init(argc, argv, "wehfou official goty", 30, "res/tset.png", + "res/font.png")) { + LZY_Log(LZY_GetError()); + LZY_Quit(); + return 1; + } + + while (!LZY_ShouldQuit()) { + /* update */ + LZY_CycleEvents(); + + 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_DrawEnd(); + } + + LZY_Log("cya"); + LZY_Quit(); + + return 0; +} |