commit 52c7683e46472bb86513218491fa42f265a08628 parent 0081d6f2d6c3e20c7bb6e37ad4984f9ba3a39fbb Author: amin <dev@aminmesbah.com> Date: Sat, 5 Aug 2017 10:19:54 +0000 Add Vim keybindings. FossilOrigin-Name: e36203d4caf9236f55c0dfc4ebfab57a214a5b348a98dcbe5eb789a0316d21e6 Diffstat:
M | README.md | | | 2 | +- |
M | src/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; }