LibGame
v0.4.0
The LG Game Engine - Copyright (C) 2024 ETMSoftware
|
Functions | |
uint8_t | lg_get_special_keys_state (uint32_t *key) |
void | lg_get_motion_and_shot_from_keyboard (int *motion_x, int *motion_y, zboolean *shot, uint32_t *key) |
void | lg_wait_for_key_pressed (uint32_t key) |
uint32_t | lg_wait_for_key_from_set_pressed (int n_keys, uint32_t key[LG_N_KEYS_MAX]) |
uint32_t | lg_wait_for_any_key_pressed () |
uint32_t | lg_return_key_pressed () |
void | lg_flush_keyb_buf () |
=== Keyboard-related stuff ===
uint8_t lg_get_special_keys_state | ( | uint32_t * | key | ) |
Get arrow (<left>, <right>, <up>, <down>) and other special keys (<enter>, <esc>, <space, and <F1> -> <F12>) state
Return an arrow keys mask and set 'key' param
=== This is the func you can/should use to get keyboard inputs inside the game main loop ===
Do NOT invoke SDL_PollEvent(), unlike other funcs here
void lg_get_motion_and_shot_from_keyboard | ( | int * | motion_x, |
int * | motion_y, | ||
zboolean * | shot, | ||
uint32_t * | key | ||
) |
Get motion and shot from keyboard
Used in BASP - check/update or use lg_get_special_keys_state() instead
motion_x | Pointer to int, returned value = 0 / +1 / -1 |
motion_y | Pointer to int, returned value = 0 / +1 / -1 |
shot | Pointer to zboolean, returned value = TRUE / FALSE |
key | Pointer to uint32_t//unsigned long, returned value = pressed key (0 if none) |
void lg_wait_for_key_pressed | ( | uint32_t | key | ) |
Wait until a specific key is pressed
key | The specific key |
uint32_t lg_wait_for_key_from_set_pressed | ( | int | n_keys, |
uint32_t | key[LG_N_KEYS_MAX] | ||
) |
Wait until a key from a key set is pressed
n_keys | Num of keys |
key[LG_N_KEYS_MAX] | A key set |
uint32_t lg_wait_for_any_key_pressed | ( | ) |
Wait until a key (any key) is pressed
uint32_t lg_return_key_pressed | ( | ) |
Get last pressed key - //doesn't remove the event in this case (event.type == SDL_KEYDOWN)
void lg_flush_keyb_buf | ( | ) |
Flush keyboard buffer