Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added easily expandable macro for reducing repetition and better debugging for ConsoleMouseKbdHandler controls #79

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions prog/samples/commonFramework/de3_freeCam_mk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@ class MouseKbdFreeCameraDriver : public IFreeCameraDriver, public ecs::IGenHidEv
else
{
HumanInput::KeyboardRawState &kbd = HumanInput::raw_state_kbd;
flyMode->keys.left =
int((kbd.isKeyDown(HumanInput::DKEY_LEFT) && moveWithArrows) || (kbd.isKeyDown(HumanInput::DKEY_A) && moveWithWASD));
flyMode->keys.right =
int((kbd.isKeyDown(HumanInput::DKEY_RIGHT) && moveWithArrows) || (kbd.isKeyDown(HumanInput::DKEY_D) && moveWithWASD));
flyMode->keys.fwd =
int((kbd.isKeyDown(HumanInput::DKEY_UP) && moveWithArrows) || (kbd.isKeyDown(HumanInput::DKEY_W) && moveWithWASD));
flyMode->keys.back =
int((kbd.isKeyDown(HumanInput::DKEY_DOWN) && moveWithArrows) || (kbd.isKeyDown(HumanInput::DKEY_S) && moveWithWASD));
#define MKEY(arrows, wasd) int((kbd.isKeyDown(arrows) && moveWithArrows) || (kbd.isKeyDown(wasd) && moveWithWASD));
flyMode->keys.left = MKEY(HumanInput::DKEY_LEFT, HumanInput::DKEY_A);
flyMode->keys.right = MKEY(HumanInput::DKEY_RIGHT, HumanInput::DKEY_D);
flyMode->keys.fwd = MKEY(HumanInput::DKEY_UP, HumanInput::DKEY_W);
flyMode->keys.back = MKEY(HumanInput::DKEY_DOWN, HumanInput::DKEY_S);
#undef MKEY
flyMode->keys.worldUp = int(kbd.isKeyDown(HumanInput::DKEY_E));
flyMode->keys.worldDown = int(kbd.isKeyDown(HumanInput::DKEY_C));
flyMode->keys.turbo = int(kbd.isKeyDown(HumanInput::DKEY_LSHIFT));
Expand Down
Loading