OgreBites input system: Control keys Topic is solved

Problems building or running the engine, queries about how to use features etc.
slapin
Bronze Sponsor
Bronze Sponsor
Posts: 392
Joined: Fri May 23, 2025 5:04 pm
x 29

OgreBites input system: Control keys

Post by slapin »

Hi, all!
In latest Ogre 14.x (master branch) how can I use OgreBites input listener to read CTRL keys separately?
So I need to know when LCTRL or RCTRL pressed and identify when they are pressed or in combination with other keys.

chilly willy
Halfling
Posts: 83
Joined: Tue Jun 02, 2020 4:11 am
x 29

Re: OgreBites input system: Control keys

Post by chilly willy »

Override bool InputListener::keyPressed(const KeyboardEvent& evt).

evt.keysym.sym is the key being pressed.
evt.keysym.mod is bitflags for the modifiers currently held.

For evt.keysym.mod OgreInput.h has, among others, KMOD_CTRL which has two bits set: 0x0040 | 0x0080. One is the left ctrl the other is the right ctrl.

For evt.keysym.sym the header has SDLK_ constants for some keys, but not every key. You can find them for any key by having your listener print the key code and then pressing the key.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 392
Joined: Fri May 23, 2025 5:04 pm
x 29

Re: OgreBites input system: Control keys

Post by slapin »

Hi, thanks a lot for explanation.
But how cross-platform are the codes in evt.keysym.sym and is it guaranteed I get something in there for Linux, Windows and Android?