Ocular Engine
|
#include <InputHandler.hpp>
Public Member Functions | |
void | update () |
void | triggerKeyboardKeyDown (KeyboardKeys key) |
void | triggerMouseButtonDown (MouseButtons button) |
void | triggerKeyboardKeyUp (KeyboardKeys key) |
void | triggerMouseButtonUp (MouseButtons button) |
void | triggerMouseMoveDelta (Math::Vector2i const &delta) |
void | setMousePosition (Math::Vector2i const &position) |
void | triggerMouseScrollDelta (int8_t delta) |
Math::Vector2i const & | getMousePosition () const |
bool | isKeyboardKeyDown (KeyboardKeys key) const |
bool | isMouseButtonDown (MouseButtons button) const |
bool | isLeftShiftDown () const |
bool | isRightShiftDown () const |
bool | isLeftCtrlDown () const |
bool | isRightCtrlDown () const |
bool | isLeftAltDown () const |
bool | isRightAltDown () const |
bool | isLeftMouseDown () const |
bool | isRightMouseDown () const |
Static Public Member Functions | |
static std::string | ToString (KeyState state) |
static std::string | ToString (MouseButtons button) |
static std::string | ToString (KeyboardKeys key) |
Receives all low-level system input messages regarding the keyboard and mouse devices, and generates appropriate input events off of them.
Also allows for any-time querying of the state of the input devices.
Math::Vector2i const & Ocular::Core::InputHandler::getMousePosition | ( | ) | const |
Retrieves the current mouse position in window coordinates.
bool Ocular::Core::InputHandler::isKeyboardKeyDown | ( | KeyboardKeys | key | ) | const |
Checks if the specified keyboard key is down. See Ocular::Core::KeyboardKeys for supported keys to query.
[in] | key | Which key to check the state of. |
bool Ocular::Core::InputHandler::isLeftAltDown | ( | ) | const |
Checks if the left alt keyboard key is down. Convenience method that works identically to:
isKeyboardKeyDown(KeyboardKeys::AltLeft);
bool Ocular::Core::InputHandler::isLeftCtrlDown | ( | ) | const |
Checks if the left ctrl keyboard key is down. Convenience method that works identically to:
isKeyboardKeyDown(KeyboardKeys::CtrlLeft);
bool Ocular::Core::InputHandler::isLeftMouseDown | ( | ) | const |
Checks if the left mouse button is down. Convenience method that works identically to:
isMouseButtonDown(MouseButtons::Left);
bool Ocular::Core::InputHandler::isLeftShiftDown | ( | ) | const |
Checks if the left shift keyboard key is down. Convenience method that works identically to:
isKeyboardKeyDown(KeyboardKeys::ShiftLeft);
bool Ocular::Core::InputHandler::isMouseButtonDown | ( | MouseButtons | button | ) | const |
Checks if the specified mouse key is down. See Ocular::Core::MouseButtons for supported keys to query.
[in] | button | Which key to check the state of. |
bool Ocular::Core::InputHandler::isRightAltDown | ( | ) | const |
Checks if the right alt keyboard key is down. Convenience method that works identically to:
isKeyboardKeyDown(KeyboardKeys::AltRight);
bool Ocular::Core::InputHandler::isRightCtrlDown | ( | ) | const |
Checks if the right ctrl keyboard key is down. Convenience method that works identically to:
isKeyboardKeyDown(KeyboardKeys::CtrlRight);
bool Ocular::Core::InputHandler::isRightMouseDown | ( | ) | const |
Checks if the right mouse button is down. Convenience method that works identically to:
isMouseButtonDown(MouseButtons::Right);
bool Ocular::Core::InputHandler::isRightShiftDown | ( | ) | const |
Checks if the right shift keyboard key is down. Convenience method that works identically to:
isKeyboardKeyDown(KeyboardKeys::ShiftRight);
void Ocular::Core::InputHandler::setMousePosition | ( | Math::Vector2i const & | position | ) |
Sets the mouse position.
Typically used by the low-level input readers, but can also be used to simulate mouse movement if needed.
[in] | position | New mouse position. |
void Ocular::Core::InputHandler::triggerKeyboardKeyDown | ( | KeyboardKeys | key | ) |
Triggers the specified keyboard key down.
Typically used by the low-level input readers, but can also be used to simulate a key press if needed.
[in] | key | The keyboard key to trigger. See Ocular::Core::KeyboardKeys |
void Ocular::Core::InputHandler::triggerKeyboardKeyUp | ( | KeyboardKeys | key | ) |
Triggers the specified keyboard key up.
Typically used by the low-level input readers, but can also be used to simulate a key release if needed.
[in] | key | The keyboard key to trigger. See Ocular::Core::KeyboardKeys |
void Ocular::Core::InputHandler::triggerMouseButtonDown | ( | MouseButtons | button | ) |
Triggers the specified mouse button down.
Typically used by the low-level input readers, but can also be used to simulate a button press if needed.
[in] | button | The mouse button to trigger. See Ocular::Core::MouseButtons |
void Ocular::Core::InputHandler::triggerMouseButtonUp | ( | MouseButtons | button | ) |
Triggers the specified mouse button up.
Typically used by the low-level input readers, but can also be used to simulate a button release if needed.
[in] | button | The mouse button to trigger. See Ocular::Core::MouseButtons |
void Ocular::Core::InputHandler::triggerMouseMoveDelta | ( | Math::Vector2i const & | delta | ) |
[in] | xDelta | |
[in] | yDelta |
void Ocular::Core::InputHandler::triggerMouseScrollDelta | ( | int8_t | delta | ) |
Applies a delta value to the mouse wheel.
[in] | delta |
void Ocular::Core::InputHandler::update | ( | ) |
If enough time has elapsed, the keyboard and mouse states are checked. Input events are generated if any keys or buttons have been changed.