The Socrates Gameboy Advance Development Engine
The SGADE is a development library for the Nintendo Gameboy
Advance. It's free for all uses and is distributed without guarantees.
For more information visit
the SGADE page.
Files | |
| file | SoKeys.c |
| file | SoKeys.h |
Defines | |
| #define | SO_KEY_A |
| A key identifier;. | |
| #define | SO_KEY_B |
| B key identifier;. | |
| #define | SO_KEY_SELECT |
| Select key identifier;. | |
| #define | SO_KEY_START |
| Start key identifier;. | |
| #define | SO_KEY_RIGHT |
| D-pad right key identifier;. | |
| #define | SO_KEY_LEFT |
| D-pad left key identifier;. | |
| #define | SO_KEY_UP |
| D-pad up key identifier;. | |
| #define | SO_KEY_DOWN |
| D-pad down key identifier;. | |
| #define | SO_KEY_R |
| R shoulder key identifier;. | |
| #define | SO_KEY_L |
| L shoulder key identifier;. | |
| #define | SO_KEY_ANY |
| All key identifiers, handy for any-key presses;. | |
Functions | |
| void | SoKeysUpdate (void) |
| Updates the key status. | |
| u16 | SoKeysGetState (void) |
| Returns the current key status bitmap. | |
| bool | SoKeysDown (u16 a_Keys) |
| Returns true if the given keys are down at the moment;. | |
| bool | SoKeysPressed (u16 a_Keys) |
| Tests the given keys have been pressed in between the last two calls to SoKeysUpdate. | |
| bool | SoKeysReleased (u16 a_Keys) |
| Tests the given keys have been released in between the last two calls to SoKeysUpdate. | |
| bool | SoKeysPressedRepeat (u16 a_Keys) |
| Not yet supported. | |
| void | SoKeysSetRepeatDelay (u16 a_nDelay) |
| Not yet supported. | |
| void | SoKeysSetRepeatSpeed (u16 a_nSpeed) |
| Not yet supported. | |
Singleton
This module handles everything key related. It contains macros for testing whether or not a key is pressed, down or released. See the different functions for the difference between down, pressed and released.
|
|
Returns true if the given keys are down at the moment;.
if ( SoKeysDown( SO_KEY_A | SO_KEY_B ) ) { // Key A and/or B are down; } |
|
|
Returns the current key status bitmap.
This function returns a bitmap containing the current up/down status of each key. |
|
|
Tests the given keys have been pressed in between the last two calls to SoKeysUpdate.
|
|
|
Tests the given keys have been released in between the last two calls to SoKeysUpdate.
|
|
|
Updates the key status.
This function should be called once each frame in order to maintain correct key status bitmaps. The less often this function is called, the more likely that some keypresses will be missed. Calling the function more often than once a frame provides no benefit and reduces the value of the key transition functions SoKeysPressed and SoKeysReleased. |