summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2022-10-22 16:02:30 +0200
committerStanislaw Halik <sthalik@misaki.pl>2022-10-22 16:02:30 +0200
commita9fe1476f1508619fc7d5f994164e04e0dfc184a (patch)
tree8642fb9dbcab3268472c5ead28478a082c217787
parentf1330bf596b045131ba2906e0b99646835257456 (diff)
add more keybindings
-rw-r--r--main/app.hpp3
-rw-r--r--main/keyboard.cpp14
2 files changed, 11 insertions, 6 deletions
diff --git a/main/app.hpp b/main/app.hpp
index 5ae0ff9a..2876dbc8 100644
--- a/main/app.hpp
+++ b/main/app.hpp
@@ -87,8 +87,9 @@ private:
enum class key : int {
camera_up, camera_left, camera_right, camera_down, camera_reset,
+ rotate_tile, quicksave, quickload,
quit,
- MAX
+ MAX = quit, COUNT
};
void make_test_chunk(chunk& c);
diff --git a/main/keyboard.cpp b/main/keyboard.cpp
index 90be44e2..a700d0f4 100644
--- a/main/keyboard.cpp
+++ b/main/keyboard.cpp
@@ -9,20 +9,24 @@ void app::do_key(KeyEvent::Key k, KeyEvent::Modifiers m, bool pressed, bool repe
(void)m;
(void)repeated;
- const key x = fm_begin(switch (k) {
- using enum KeyEvent::Key;
- using enum key;
+ const key x = fm_begin(switch (k)
+ {
+ using enum KeyEvent::Key;
+ using enum key;
+ default: return COUNT;
case W: return camera_up;
case A: return camera_left;
case S: return camera_down;
case D: return camera_right;
case Home: return camera_reset;
+ case R: return rotate_tile;
+ case F5: return quicksave;
+ case F9: return quickload;
case Esc: return quit;
- default: return MAX;
});
- if (x != key::MAX)
+ if (x != key::COUNT)
keys[x] = pressed;
}