diff options
author | BoredGuy <osome3717@gmail.com> | 2024-12-31 10:22:43 +0300 |
---|---|---|
committer | BoredGuy <osome3717@gmail.com> | 2024-12-31 10:22:43 +0300 |
commit | dd83126b20122915ca673f0f385d089743f8bc4b (patch) | |
tree | ff53fc94153b03a6301f048d15352f1885b058f1 /Week1-Pacman/src/main.c | |
parent | df5888dde7755175f4ee300a87c2e983c5b384c4 (diff) |
More Muvement Improvements
- You can now hold a direction to turn to in the next frame
Diffstat (limited to 'Week1-Pacman/src/main.c')
-rw-r--r-- | Week1-Pacman/src/main.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Week1-Pacman/src/main.c b/Week1-Pacman/src/main.c index 0fe38bf..5d2439a 100644 --- a/Week1-Pacman/src/main.c +++ b/Week1-Pacman/src/main.c @@ -35,6 +35,8 @@ int main(int argc, char** argv) { struct map map = {0}; load_map("assets/Maps/maze.csv", &map); + const char* keyboard = + SDL_GetKeyboardState(NULL); for(int i = 0; i < 4; i++) init_animation(&pacman.animations[i], &(struct animation_init){ @@ -76,10 +78,10 @@ int main(int argc, char** argv) { if(e.type == SDL_QUIT) { running = false; } - - handle_pacman_input(&e, &pacman, &map); } + handle_pacman_input(keyboard, &pacman, &map); + int now = SDL_GetTicks(); float dt = (float)(now - then) / 1000; then = now; |