31 lines
554 B
C
31 lines
554 B
C
#include <gint/display.h>
|
|
#include <gint/keyboard.h>
|
|
|
|
int main(void)
|
|
{
|
|
int running = 1;
|
|
|
|
// player (i don't know how to use struct sorry)
|
|
int player_x = 50;
|
|
int player_y = 50;
|
|
|
|
// main loop
|
|
while(running) {
|
|
|
|
dclear(C_WHITE);
|
|
// drawing the player
|
|
drect(player_x, player_y, player_x + 16, player_y + 16, C_GREEN);
|
|
dupdate();
|
|
|
|
clearevents();
|
|
|
|
// trying to move the player >w<
|
|
player_x += keydown(KEY_RIGHT) - keydown(KEY_LEFT);
|
|
player_y += keydown(KEY_DOWN) - keydown(KEY_UP);
|
|
|
|
if(keydown(KEY_EXIT)) {running = 0;}
|
|
}
|
|
|
|
return 1;
|
|
}
|