1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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;
}
|