Go to the source code of this file.
|
| char | gm_lower_case (char k) |
| | Converts a character to lowercase if it's an uppercase letter.
|
| char | gm_upper_case (char k) |
| | Converts a character to uppercase if it's a lowercase letter.
|
| void | gm_decode_key_shortcut (char key, char *t, char *k) |
| | Decodes a single character shortcut into a key type and key code.
|
| char | gm_encode_key_shortcut (char t, char k) |
| | Encodes a key type and code into a single character shortcut. This is the reverse of gm_decode_key_shortcut.
|
| int | gm_key_down (char t, char k) |
| | Checks if a key is currently pressed.
|
| int | gm_key (char key) |
| | Checks if a key is currently pressed using a single character shortcut.
|
◆ gm_decode_key_shortcut()
| void gm_decode_key_shortcut |
( |
char | key, |
|
|
char * | t, |
|
|
char * | k ) |
Decodes a single character shortcut into a key type and key code.
This function translates a compact shortcut character into its corresponding event type and key, used by gm_key_down.
- 'U', 'D', 'L', 'R' -> type 'a' (arrow)
- 'E' -> type 's' (special), key 'x'
- 'S', 'C', 'A' -> type 'm' (modifier: Shift, Ctrl, Alt)
- Other characters -> type 'c' (character)
- Parameters
-
| key | The single character shortcut (e.g., 'U' for Up Arrow). |
| t | Pointer to store the decoded key type. |
| k | Pointer to store the decoded key code. |
◆ gm_encode_key_shortcut()
| char gm_encode_key_shortcut |
( |
char | t, |
|
|
char | k ) |
Encodes a key type and code into a single character shortcut. This is the reverse of gm_decode_key_shortcut.
- Parameters
-
| t | The key type ('a' for arrow, 'm' for modifier, 's' for special, 'c' for character). |
| k | The key code. |
- Returns
- The encoded single character shortcut.
◆ gm_key()
Checks if a key is currently pressed using a single character shortcut.
- Parameters
-
| key | The shortcut character to check (e.g., 'w', 'U' for up). |
- Returns
- 1 if the key is pressed, 0 otherwise.
- See also
- gm_decode_key_shortcut
-
gm_key_down
◆ gm_key_down()
| int gm_key_down |
( |
char | t, |
|
|
char | k ) |
Checks if a key is currently pressed.
This is the low-level input checking function.
- Parameters
-
| t | The type of key: 'c' for character, 'a' for arrow, 's' for special. |
| k | The key code to check (e.g., 'w', 'u' for up arrow). |
- Returns
- 1 if the key is pressed, 0 otherwise.
◆ gm_lower_case()
| char gm_lower_case |
( |
char | k | ) |
|
Converts a character to lowercase if it's an uppercase letter.
- Parameters
-
| k | The character to convert. |
- Returns
- The lowercase version of the character, or the original if not uppercase.
◆ gm_upper_case()
| char gm_upper_case |
( |
char | k | ) |
|
Converts a character to uppercase if it's a lowercase letter.
- Parameters
-
| k | The character to convert. |
- Returns
- The uppercase version of the character, or the original if not lowercase.