Skip to content

Input Functions

Merijn Hendriks edited this page Mar 24, 2019 · 5 revisions
void automataInputInit(GLFWwindow *window)

Initializes the input module.

void automataInputUpdate()

Updates the input.

int automataInputGetKey(AutomataInputKey key)

Returns 1 if the key is pressed, otherwise 0.

key: the keycode.

note: key cannot be AUTOMATA_KEY_UNKNOWN or lower, nor higher than AUTOMATA_KEY_GAMEPAD_16_20.

int automataInputGetAnyKey()

Returns 1 if any key is pressed, otherwise 0.

AutomataInputKey automataInputDetectKey()

Returns the keycode if any key is pressed, otherwise it returns AUTOMATA_KEY_UNKNOWN.

double automataInputGetAxis(AutomataInputAxis axis)

Returns the value of the axis.

axis: the axis.

note: axis cannot be AUTOMATA_KEY_UNKNOWN or lower, nor higher than AUTOMATA_AXIS_GAMEPAD_RTHUMB_Y.

int automataInputGetGamepadState(AutomataInputGamepad gamepad)

Returns 1 if the gamepad is connected, otherwise 0.

gamepad: the gamepad.

note: gamepad cannot be AUTOMATA_KEY_UNKNOWN or lower, nor higher than AUTOMATA_GAMEPAD_16.

const char* automataInputGetGamepadName(AutomataInputGamepad gamepad)

Returns the gamepad name.

gamepad: the gamepad.

note: gamepad cannot be AUTOMATA_KEY_UNKNOWN or lower, nor higher than AUTOMATA_GAMEPAD_16.

void automataInputSetCursorVisible(int visible)

Toggles cursor visibility.

visible: cursor visibility mode.

note: visible can't be lower than 0 or higher than 1.

void automataInputSetCursorIcon(int width, int height, unsigned char *pixels)

Set the cursor icon.

width: the image width.
height: the image height.
pixels: the image pixels.

note: width and height cannot be lower than 0. pixels cannot be NULL.

void automataInputRemoveCursorIcon()

Resets cursor to OS default.

Clone this wiki locally