Simple Game Graphics Library 1.1
Input handling

Functions

void getMouseState (MouseState &ms)
bool getKeyState (scancode_t key)

Detailed Description

Function Documentation

◆ getKeyState()

bool getKeyState ( scancode_t key)

Polls the engine for the current state of a specific key.

Since buttons can be queried individually, multiple pressed keys can be detected, by querying each one of them. The function shall return true if a button has been reported as pressed by a window event between the previous call to the update function and the current call to getKeyState().

Parameters
keyis the scancode ID of the key to query. The available scancodes are listed in the scancodes.h file.
Returns
true if the key is pressed, false otherwise.
See also
setUpdateFunction

◆ getMouseState()

void getMouseState ( MouseState & ms)

Polls the engine for the current state of the mouse.

Stores in the user-provided MouseState record ms, the current status of all mouse events. For more information on what data can be obtained, see the MouseState structure. Typically, this function is used from within the update callback of the application.

Parameters
msis the user-provided record to update with the current status of the mouse cursor button and higher-level information such as mouse "dragging" and button "pressed / released".
See also
MouseState
setUpdateFunction