51 lines
866 B
C
51 lines
866 B
C
#define LZY_IMPLEMENTATION
|
|
#include "lzy.h"
|
|
#include <stdint.h>
|
|
|
|
static void draw_player(int x, int y);
|
|
|
|
int main(void) {
|
|
int x = 0;
|
|
int y = 0;
|
|
|
|
if (LZY_Init("lzy example", 30)) {
|
|
LZY_Log(LZY_GetError());
|
|
LZY_Quit();
|
|
return 1;
|
|
}
|
|
LZY_Log("init was great success!");
|
|
|
|
do {
|
|
/* update */
|
|
LZY_CycleEvents();
|
|
if (LZY_KeyDown(LZYK_LEFT))
|
|
x--;
|
|
if (LZY_KeyDown(LZYK_RIGHT))
|
|
x++;
|
|
if (LZY_KeyDown(LZYK_UP))
|
|
y--;
|
|
if (LZY_KeyDown(LZYK_DOWN))
|
|
y++;
|
|
|
|
/* draw */
|
|
LZY_DrawBegin();
|
|
{
|
|
LZY_DrawSetColor(0x20, 0x20, 0x00);
|
|
LZY_DrawClear();
|
|
draw_player(x, y);
|
|
}
|
|
LZY_DrawEnd();
|
|
} while (!LZY_ShouldQuit());
|
|
|
|
LZY_Log("cya");
|
|
LZY_Quit();
|
|
return 0;
|
|
}
|
|
|
|
static void draw_player(int x, int y) {
|
|
LZY_DrawSetColor(0x00, 0xff, 0xff);
|
|
LZY_DrawFillRect(x, y, 8, 8);
|
|
LZY_DrawSetColor(0xff, 0x00, 0x00);
|
|
LZY_DrawRect(x + 1, y + 1, 6, 6);
|
|
}
|