Class definitions. More...
#include <inputengine.h>
Public Member Functions | |
InputEngine (Kernel *pKernel) | |
bool | init () |
void | update () |
bool | isLeftMouseDown () |
bool | isRightMouseDown () |
bool | wasLeftMouseDown () |
bool | wasRightMouseDown () |
bool | isLeftDoubleClick () |
int | getMouseX () |
int | getMouseY () |
void | setMouseX (int posX) |
void | setMouseY (int posY) |
bool | isKeyDown (uint keyCode) |
bool | wasKeyDown (uint keyCode) |
void | setCharacterCallback (CharacterCallback callback) |
void | setCommandCallback (CommandCallback callback) |
void | reportCharacter (byte character) |
void | reportCommand (KEY_COMMANDS command) |
bool | persist (OutputPersistenceBlock &writer) override |
bool | unpersist (InputPersistenceBlock &reader) override |
Additional Inherited Members | |
Protected Member Functions inherited from Sword25::Service | |
Service (Kernel *pKernel) | |
Kernel * | GetKernel () const |
Class definitions.
bool Sword25::InputEngine::init | ( | ) |
Initializes the input engine
void Sword25::InputEngine::update | ( | ) |
Performs a "tick" of the input engine.
This method should be called once per frame. It can be used by implementations of the input engine that are not running in their own thread, or to perform additional administrative tasks that are needed.
bool Sword25::InputEngine::isLeftMouseDown | ( | ) |
Returns true if the left mouse button is pressed
bool Sword25::InputEngine::isRightMouseDown | ( | ) |
Returns true if the right mouse button is pressed.
bool Sword25::InputEngine::wasLeftMouseDown | ( | ) |
Returns true if the left mouse button was pressed and released.
The difference between this and IsLeftMouseDown() is that this only returns true when the left mouse button is released.
bool Sword25::InputEngine::wasRightMouseDown | ( | ) |
Returns true if the right mouse button was pressed and released.
The difference between this and IsRightMouseDown() is that this only returns true when the right mouse button is released.
bool Sword25::InputEngine::isLeftDoubleClick | ( | ) |
Returns true if the left mouse button double click was done
int Sword25::InputEngine::getMouseX | ( | ) |
Returns the X position of the cursor in pixels
int Sword25::InputEngine::getMouseY | ( | ) |
Returns the Y position of the cursor in pixels
void Sword25::InputEngine::setMouseX | ( | int | posX | ) |
Sets the X position of the cursor in pixels
void Sword25::InputEngine::setMouseY | ( | int | posY | ) |
Sets the Y position of the cursor in pixels
bool Sword25::InputEngine::isKeyDown | ( | uint | keyCode | ) |
Returns true if a given key was pressed
KeyCode | The key code to be checked |
bool Sword25::InputEngine::wasKeyDown | ( | uint | keyCode | ) |
Returns true if a certain key was pushed and released.
The difference between IsKeyDown() is that this only returns true after the key has been released. This method facilitates the retrieval of keys, and reading strings that users type.
KeyCode | The key code to be checked |
void Sword25::InputEngine::setCharacterCallback | ( | CharacterCallback | callback | ) |
Registers a callback function for keyboard input.
The callback that is registered with this function will be called whenever an input key is pressed. A letter entry is different from the query using the methods isKeyDown() and wasKeyDown() in the sense that are treated instead of actual scan-coded letters. These were taken into account, among other things: the keyboard layout, the condition the Shift and Caps Lock keys and the repetition of longer holding the key. The input of strings by the user through use of callbacks should be implemented.
void Sword25::InputEngine::setCommandCallback | ( | CommandCallback | callback | ) |
Registers a callback function for the input of commands that can have influence on the string input
The callback that is registered with this function will be called whenever the input service has a key that affects the character string input. This could be the following keys: Enter, End, Left, Right, ... The input of strings by the user through the use of callbacks should be implemented.