.. _api_Input: Input ===== Inherited: None .. _api_Input_description: Description ----------- Use this class to get information from the inpute devices, like mouse, keyboard, joystick and etc. Note: All input data updates once per frame during Engine::update() method. Note: Many mobile devices are capable of tracking multiple fingers touching the screen simultaneously. .. _api_Input_public: Public Methods -------------- None .. _api_Input_static: Static Methods -------------- +------------------------------+-----------------------------------------------------------------------+ | uint32_t | :ref:`getCode` (const TString & name) | +------------------------------+-----------------------------------------------------------------------+ | :ref:`TString` | :ref:`inputString` () | +------------------------------+-----------------------------------------------------------------------+ | bool | :ref:`isKey` (Input::KeyCode code) | +------------------------------+-----------------------------------------------------------------------+ | bool | :ref:`isKeyDown` (Input::KeyCode code) | +------------------------------+-----------------------------------------------------------------------+ | bool | :ref:`isKeyUp` (Input::KeyCode code) | +------------------------------+-----------------------------------------------------------------------+ | bool | :ref:`isMouseButton` (int button) | +------------------------------+-----------------------------------------------------------------------+ | bool | :ref:`isMouseButtonDoubleClick` (int button) | +------------------------------+-----------------------------------------------------------------------+ | bool | :ref:`isMouseButtonDown` (int button) | +------------------------------+-----------------------------------------------------------------------+ | bool | :ref:`isMouseButtonUp` (int button) | +------------------------------+-----------------------------------------------------------------------+ | uint32_t | :ref:`joystickButtons` (uint32_t index) | +------------------------------+-----------------------------------------------------------------------+ | uint32_t | :ref:`joystickCount` () | +------------------------------+-----------------------------------------------------------------------+ | :ref:`Vector4` | :ref:`joystickThumbs` (uint32_t index) | +------------------------------+-----------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`joystickTriggers` (uint32_t index) | +------------------------------+-----------------------------------------------------------------------+ | :ref:`Vector4` | :ref:`mouseDelta` () | +------------------------------+-----------------------------------------------------------------------+ | void | :ref:`mouseLockCursor` (bool lock) | +------------------------------+-----------------------------------------------------------------------+ | :ref:`Vector4` | :ref:`mousePosition` () | +------------------------------+-----------------------------------------------------------------------+ | float | :ref:`mouseScrollDelta` () | +------------------------------+-----------------------------------------------------------------------+ | void | :ref:`mouseSetCursor` (Input::CursorShape shape) | +------------------------------+-----------------------------------------------------------------------+ | void | :ref:`setKeyboardVisible` (bool visible) | +------------------------------+-----------------------------------------------------------------------+ | uint32_t | :ref:`touchCount` () | +------------------------------+-----------------------------------------------------------------------+ | :ref:`Vector4` | :ref:`touchPosition` (uint32_t index) | +------------------------------+-----------------------------------------------------------------------+ | uint32_t | :ref:`touchState` (uint32_t index) | +------------------------------+-----------------------------------------------------------------------+ .. _api_Input_methods: Methods Description ------------------- .. _api_Input_bc1a7895: uint32_t **Input::getCode** (:ref:`TString` & *name*) Converts a key *name* to code. ---- .. _api_Input_d698ef3b: :ref:`TString` **Input::inputString** () Returns characters entered since the last frame. ---- .. _api_Input_7dac0942: bool **Input::isKey** (:ref:`Input::KeyCode` *code*) Returns true in case of a key with *code* is pressed; otherwise returns false. Please refer to Input::KeyCode to see possible key codes. ---- .. _api_Input_f63ca718: bool **Input::isKeyDown** (:ref:`Input::KeyCode` *code*) Returns true during the frame in case of a key with *code* is pressed; otherwise returns false. Please refer to Input::KeyCode to see possible key codes. ---- .. _api_Input_4836d70f: bool **Input::isKeyUp** (:ref:`Input::KeyCode` *code*) Returns true during the frame in case of a key with *code* is released; otherwise returns false. Please refer to Input::KeyCode to see possible key codes. ---- .. _api_Input_9517e0dc: bool **Input::isMouseButton** (int *button*) Returns the state of mouse button. Example code: :: if(Input::isMouseButton(0)) { aInfo() << "Left button pressed"; } if(Input::isMouseButton(1)) { aInfo() << "Right button pressed"; } if(Input::isMouseButton(3)) { aInfo() << "Middle button pressed"; } ---- .. _api_Input_9be3c601: bool **Input::isMouseButtonDoubleClick** (int *button*) Returns true in case of the *button* is double clicked; otherwise returns false. ---- .. _api_Input_67a30e2b: bool **Input::isMouseButtonDown** (int *button*) Returns true in case of the *button* is pressed; otherwise returns false. ---- .. _api_Input_4e3cf520: bool **Input::isMouseButtonUp** (int *button*) Returns true in case of the *button* is released; otherwise returns false. ---- .. _api_Input_5ac04291: uint32_t **Input::joystickButtons** (uint32_t *index*) Returns the states of buttons for joystick with index. Please refer to Input::KeyCode to see possible buttons. **Note:** This method returns a bit masked value. To retrieve the state of the required button please make bit comparison. Example code: :: if(Input::joystickButtons(0) & Input::JOYSTICK_) { ... } ---- .. _api_Input_1e7468c9: uint32_t **Input::joystickCount** () Returns the number of connected joysticks. ---- .. _api_Input_bae02f19: :ref:`Vector4` **Input::joystickThumbs** (uint32_t *index*) Returns the thumbs position of joystick with index. The components x and y will contain a value for the left thumbs. The components z and w will contain a value for the right thumbs. ---- .. _api_Input_490ae85c: :ref:`Vector2` **Input::joystickTriggers** (uint32_t *index*) Returns the value of pressure for the joystick triggers with index. The component x will contain a value for the left trigger and component y will contain value for the right trigger. ---- .. _api_Input_eb847a6f: :ref:`Vector4` **Input::mouseDelta** () Returns the mouse position delta. The absolute position will be stored in x and y components. The normalized position will be stored in z and w components. **Note:** Delta value recalculated once per frame, calling this method multiple times in one frame will return the same result. **Note:** The value will be Vector4(0.0f) if a mouse is not moved. ---- .. _api_Input_8e36f4c1: void **Input::mouseLockCursor** (bool *lock*) Tries to *lock* mouse cursor. ---- .. _api_Input_5231a867: :ref:`Vector4` **Input::mousePosition** () Returns the mouse position. The absolute position will be stored in x and y components. The normalized position will be stored in z and w components. ---- .. _api_Input_7ae63802: float **Input::mouseScrollDelta** () Returns the mouse wheel scrolling delta. **Note:** Delta value recalculated once per frame, calling this method multiple times in one frame will return the same result. **Note:** The value will be 0.0f if a mouse wheel is not rotated. ---- .. _api_Input_f98d63ac: void **Input::mouseSetCursor** (:ref:`Input::CursorShape` *shape*) Sets the cursor shape. ---- .. _api_Input_90684157: void **Input::setKeyboardVisible** (bool *visible*) Sets virtual keyboard visible. **Note:** Does nothing for the desktop platforms. ---- .. _api_Input_c953807d: uint32_t **Input::touchCount** () Returns the number of touches. ---- .. _api_Input_a1f76d32: :ref:`Vector4` **Input::touchPosition** (uint32_t *index*) Returns the position of touch with index. The absolute position will be stored in x and y components. The normalized position will be stored in z and w components. ---- .. _api_Input_8b3fd2c9: uint32_t **Input::touchState** (uint32_t *index*) Returns the state of touch with index. Please refer to Input::TouchState to see possible states.