Key debugging added

This commit is contained in:
Michael Chen 2018-01-07 14:45:07 +01:00
parent 1d91b0aedb
commit 1eb3804673

8
main.c
View File

@ -14,7 +14,7 @@ void INITIALIZE();
void QUIT(); void QUIT();
void GAMELOOP(); void GAMELOOP();
void mousePress(SDL_MouseButtonEvent b); void mousePress(SDL_MouseButtonEvent b);
void mousePress(); void keyPress(SDL_KeyboardEvent b);
const int width = 1600; // TODO: Fullscreen const int width = 1600; // TODO: Fullscreen
const int height = 900; const int height = 900;
@ -37,7 +37,7 @@ int main(int argc, char * args[]){
break; break;
case SDL_KEYDOWN: case SDL_KEYDOWN:
if (event.key.keysym.scancode == SDL_SCANCODE_ESCAPE) running = false; if (event.key.keysym.scancode == SDL_SCANCODE_ESCAPE) running = false;
else keyPress(); else keyPress(event.key);
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
mousePress(event.button); mousePress(event.button);
@ -63,8 +63,8 @@ void mousePress(SDL_MouseButtonEvent b){ // Debug prop
} }
} }
void keyPress(){ // Debug prop void keyPress(SDL_KeyboardEvent b){ // Debug prop
printf("Key pressed: ID is %d\n", b.keysym.scancode);
} }
void DrawFrame(){ void DrawFrame(){