Skip to content

Commit

Permalink
Add hotkeys for moving around
Browse files Browse the repository at this point in the history
  • Loading branch information
kolumb committed Feb 27, 2021
1 parent fd73f75 commit cd5f2d0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,11 @@ Boomer is written in Nim for Linux. Zoomer is ported to C and uses Win32 API.

| Key | Action |
|-----|--------|
| `Escape` | Quit app |
| `Q` | Quit app |
| `Escape` / `Q` | Quit |
| `0` | Reset zoom |
| `Mouse button` | Pan |
| `+` | Zoom in |
| `-` | Zoom out |
| `Scroll wheel` | Zoom +/- |
| `+` / `-` | Zoom in/out |
| `Mouse button` | Pan |
| `WASD` / `Arrows` | Move around |
| `F` | Toggle flashlight |
| `Ctrl` + `Scroll wheel` | Change size of flashlight |
17 changes: 17 additions & 0 deletions src/zoomer_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#define INITIAL_FL_DELTA_RADIUS 250.0f
#define FL_DELTA_RADIUS_DECELERATION 10.0f
#define PAN_SPEED 20.0f


typedef struct {
Expand Down Expand Up @@ -203,6 +204,22 @@ void key_callback(GLFWwindow* window, int key, int scancode, int action, int mod
camera.position = (Vector){ 0.0f, 0.0f };
camera.velocity = (Vector){ 0.0f, 0.0f };
break;
case GLFW_KEY_W:
case GLFW_KEY_UP:
camera.position.y -= PAN_SPEED;
break;
case GLFW_KEY_S:
case GLFW_KEY_DOWN:
camera.position.y += PAN_SPEED;
break;
case GLFW_KEY_A:
case GLFW_KEY_LEFT:
camera.position.x -= PAN_SPEED;
break;
case GLFW_KEY_D:
case GLFW_KEY_RIGHT:
camera.position.x += PAN_SPEED;
break;
case GLFW_KEY_F:
flashlight.is_enabled = !flashlight.is_enabled;
break;
Expand Down

0 comments on commit cd5f2d0

Please sign in to comment.