Skip to content

Commit

Permalink
input: Fix input demo keybindings-
Browse files Browse the repository at this point in the history
  • Loading branch information
heinezen committed Apr 21, 2024
1 parent c1bd240 commit 7cfa962
Showing 1 changed file with 34 additions and 10 deletions.
44 changes: 34 additions & 10 deletions libopenage/input/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,40 @@ void action_demo() {
input_action catch_all{input_action_t::CUSTOM, nop};

// events that map to specific keys/buttons
Event ev_up{event_class::KEYBOARD, Qt::Key_Up, Qt::NoModifier, QEvent::KeyRelease};
Event ev_down{event_class::KEYBOARD, Qt::Key_Down, Qt::NoModifier, QEvent::KeyRelease};

Event ev_w{event_class::KEYBOARD, Qt::Key_W, Qt::NoModifier, QEvent::KeyRelease};
Event ev_a{event_class::KEYBOARD, Qt::Key_A, Qt::NoModifier, QEvent::KeyRelease};
Event ev_s{event_class::KEYBOARD, Qt::Key_S, Qt::NoModifier, QEvent::KeyRelease};
Event ev_d{event_class::KEYBOARD, Qt::Key_D, Qt::NoModifier, QEvent::KeyRelease};

Event ev_lmb{event_class::MOUSE, Qt::LeftButton, Qt::NoModifier, QEvent::MouseButtonRelease};
Event ev_rmb{event_class::MOUSE, Qt::RightButton, Qt::NoModifier, QEvent::MouseButtonRelease};
Event ev_up{event_class::KEYBOARD,
Qt::Key::Key_Up,
Qt::KeyboardModifier::NoModifier,
QEvent::KeyRelease};
Event ev_down{event_class::KEYBOARD,
Qt::Key::Key_Down,
Qt::KeyboardModifier::NoModifier,
QEvent::KeyRelease};

Event ev_w{event_class::KEYBOARD,
Qt::Key::Key_W,
Qt::KeyboardModifier::NoModifier,
QEvent::KeyRelease};
Event ev_a{event_class::KEYBOARD,
Qt::Key::Key_A,
Qt::KeyboardModifier::NoModifier,
QEvent::KeyRelease};
Event ev_s{event_class::KEYBOARD,
Qt::Key::Key_S,
Qt::KeyboardModifier::NoModifier,
QEvent::KeyRelease};
Event ev_d{event_class::KEYBOARD,
Qt::Key::Key_D,
Qt::KeyboardModifier::NoModifier,
QEvent::KeyRelease};

Event ev_lmb{event_class::MOUSE_BUTTON,
Qt::MouseButton::LeftButton,
Qt::KeyboardModifier::NoModifier,
QEvent::MouseButtonRelease};
Event ev_rmb{event_class::MOUSE_BUTTON,
Qt::MouseButton::RightButton,
Qt::KeyboardModifier::NoModifier,
QEvent::MouseButtonRelease};

// bind events to actions in the contexts
mgr.get_global_context()->bind(ev_up, push_a);
Expand Down

0 comments on commit 7cfa962

Please sign in to comment.