summaryrefslogtreecommitdiffhomepage
path: root/main/keyboard.cpp
blob: a700d0f49674a4e170ba9c3632ce6349ea50d2ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "app.hpp"

namespace floormat {

void app::do_key(KeyEvent::Key k, KeyEvent::Modifiers m, bool pressed, bool repeated)
{
    //using Mods = KeyEvent::Modifiers;

    (void)m;
    (void)repeated;

    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;
    });

    if (x != key::COUNT)
        keys[x] = pressed;
}

app::~app()
{
    loader_::destroy();
}

} // namespace floormat