diff options
author | Johnny Richard <johnny@johnnyrichard.com> | 2021-04-13 02:53:13 +0200 |
---|---|---|
committer | Johnny Richard <johnny@johnnyrichard.com> | 2021-10-28 02:22:57 +0200 |
commit | d8336885a4c053544fe3491335da0f76afffdfb9 (patch) | |
tree | b3cd866a257406281144075c0af2407b9de2978c /src/main.c | |
parent | 9a285cc3bdb8d5870fea5f07235a3e44786a0317 (diff) |
Move controller update to a new update function
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 38 |
1 files changed, 1 insertions, 37 deletions
@@ -47,43 +47,7 @@ main (int argc, if (event.type == SDL_QUIT) { quit = true; } - - if (event.type == SDL_KEYDOWN) { - switch (event.key.keysym.sym) { - case SDLK_UP: - controller.up = true; - break; - case SDLK_DOWN: - controller.down = true; - break; - case SDLK_LEFT: - controller.left = true; - break; - case SDLK_RIGHT: - controller.right = true; - break; - } - } - - if (event.type == SDL_KEYUP) { - switch (event.key.keysym.sym) { - case SDLK_UP: - controller.up = false; - break; - - case SDLK_DOWN: - controller.down = false; - break; - - case SDLK_LEFT: - controller.left = false; - break; - - case SDLK_RIGHT: - controller.right = false; - break; - } - } + controller_update(&controller, &event); } if (controller.up) rect.y -= 1; |