Gama C Library
Gama C API Documentation
Loading...
Searching...
No Matches
key.h File Reference
#include "gapi.h"

Go to the source code of this file.

Functions

int gm_key_pressed (char t, char k)
 Checks if a key is currently pressed.
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 key shortcut into a type and key character.
char gm_encode_key_shortcut (char t, char k)
 Encodes a type and key character into a shortcut key.
int gm_key (char key)
 Checks if a key is currently pressed using a shortcut key.

Function Documentation

◆ gm_decode_key_shortcut()

void gm_decode_key_shortcut ( char key,
char * t,
char * k )

Decodes a key shortcut into a type and key character.

Parameters
keyThe shortcut key to decode.
tPointer to store the decoded key type.
kPointer to store the decoded key character.

◆ gm_encode_key_shortcut()

char gm_encode_key_shortcut ( char t,
char k )

Encodes a type and key character into a shortcut key.

Parameters
tThe key type ('a' for arrow keys, 'm' for mouse events, 's' for special keys, 'c' for character keys).
kThe key character.
Returns
The encoded shortcut key.

◆ gm_key()

int gm_key ( char key)

Checks if a key is currently pressed using a shortcut key.

Parameters
keyThe shortcut key to check.
Returns
1 if the key is pressed, 0 otherwise.

◆ gm_key_pressed()

int gm_key_pressed ( char t,
char k )

Checks if a key is currently pressed.

Parameters
tThe type of key event ('a' for arrow keys, 'm' for mouse events, 's' for special keys, 'c' for character keys).
kThe specific key character or identifier.
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
kThe 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
kThe character to convert.
Returns
The uppercase version of the character, or the original if not lowercase.