S Key Map
Note: The correct name is SKeyMap, however due to technical reasons the pagetitle is S Key Map (Wrong)
The SKeyMap is a struct, it contains two members:
Action and KeyCode
The SKeyMap is used to make custom key specifications for the CameraSceneNodeFPS.
The Action member contains the following enumerators:
EKA_MOVE_FORWARD EKA_MOVE_BACKWARD EKA_STRAFE_LEFT EKA_STRAFE_RIGHT EKA_JUMP_UP EKA_CROUCH //Not actually used in the FPS camera (?) EKA_COUNT //Not actually used in the FPS camera and purpose is unclear (?) EKA_FORCE_32BIT //This value is not used. It only forces this enumeration to compile in 32 bit.
The KeyCode member uses the standard Irrlicht Keycodes
To specify new key specifications we start off by creating a new variable of the kind SKeyMap
SKeyMap keyMap[2];
The 2 in between the brackets ([]) means it will hold two different Action/KeyCode pairs. If you want to use more keys you have to increase this number.
So let's define what keys we use for forward movement (EKA_MOVE_FORWARD)
keyMap[0].Action = EKA_MOVE_FORWARD; //We want to associate this key with forward movement
keyMap[0].KeyCode = KEY_KEY_W; //We want to use the W key to move forward
So there, now we can move forward using the W key.
Say we want to accommodate people who like using the arrow keys too, very simple:
keyMap[1].Action = EKA_MOVE_FORWARD;
//We want to associate another key with the forward movement.
//Notice we moved to the next field in our KeyMap array
keyMap[1].KeyCode = KEY_UP; //We want to move forward using the up arrow too
So now we can move forward using either our W key or our Up Arrow key.
If you want to add more keys for different actions just change the action value to the action you like and use the correct keycode.
In order to use this keyMap you have to pass it along to the function addCameraSceneNodeFPS as the 5th parameter.