star-sim

Barnes-Hut gravity simulation.
Log | Files | Refs | README | LICENSE

commit 4e1f24723874331ca4c34f74c1274808634f8aeb
parent 4e00749fd671fd95cf21ee9f12b4043f96ea2719
Author: Amin Mesbah <mesbahamin@gmail.com>
Date:   Sat,  5 Aug 2017 03:19:55 -0700

Add Vim keybindings.

Diffstat:
MREADME.md | 2+-
Msrc/platform_sdl.c | 9+++++----
2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md @@ -10,7 +10,7 @@ efficiently calculate the forces acting on each star. ### Keyboard Shortcuts -- `WASD`: Pan. +- `WASD` or `HJKL`: Pan. - `Arrow Keys`: Slow Pan. - `Home`: Center View. - `b`: Toggle bounding box rendering. diff --git a/src/platform_sdl.c b/src/platform_sdl.c @@ -207,19 +207,20 @@ int main(int argc, char *argv[]) const uint8_t *keystate = SDL_GetKeyboardState(0); - if (keystate[SDL_SCANCODE_A]) + // TODO: move this to a function + if (keystate[SDL_SCANCODE_A] || keystate[SDL_SCANCODE_H]) { sim_state.view.dx += 5; } - if (keystate[SDL_SCANCODE_D]) + if (keystate[SDL_SCANCODE_D] || keystate[SDL_SCANCODE_L]) { sim_state.view.dx -= 5; } - if (keystate[SDL_SCANCODE_W]) + if (keystate[SDL_SCANCODE_W] || keystate[SDL_SCANCODE_K]) { sim_state.view.dy += 5; } - if (keystate[SDL_SCANCODE_S]) + if (keystate[SDL_SCANCODE_S] || keystate[SDL_SCANCODE_J]) { sim_state.view.dy -= 5; }