Skip to content

Commit

Permalink
added easily expandable macro for reducing repetition and better debu…
Browse files Browse the repository at this point in the history
…gging
  • Loading branch information
RandomGamingDev committed Sep 5, 2024
1 parent 71a2658 commit c7dc7f6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Binary file not shown.
Binary file not shown.
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

0 comments on commit c7dc7f6

Please sign in to comment.