Keyboard.getState

Returns the pointer to the Keyboard state. With that you can check if some key is pressed without using a event queue. A value of 1 means that the key is pressed and a value of 0 means that it is not. The pointer will be valid for the whole lifetime of the application and should not be freed by the caller.

Note: This function gives you the current state after all events have been processed, so if a key or button has been pressed and released before you process events, then the pressed state will never show up in the update calls. Note: This function doesn't take into account whether shift has been pressed or not.

class Keyboard
static
ubyte*
getState
()

Examples

ubyte* keyStates = Keyboard.getState();
if (keyStates[Keyboard.ScanCode.Escape])
    writeln("escape is pressed.");

Meta