libtonc
tonc_input.h File Reference
#include "tonc_memmap.h"
#include "tonc_memdef.h"
#include "tonc_core.h"

Macros

#define KEY_FULL   0xFFFFFFFF
 Define for checking all keys.
 
#define KEY_DOWN_NOW(key)   (~(REG_KEYINPUT) & key)
 
#define KEY_UP_NOW(key)   ( (REG_KEYINPUT) & key)
 
#define KEY_EQ(key_fun, keys)   ( key_fun(keys) == (keys) )
 
#define KEY_TRIBOOL(fnKey, plus, minus)    ( bit_tribool(fnKey(KEY_FULL), plus, minus) )
 

Typedefs

typedef enum eKeyIndex eKeyIndex
 

Enumerations

enum  eKeyIndex {
  KI_A =0 , KI_B , KI_SELECT , KI_START ,
  KI_RIGHT , KI_LEFT , KI_UP , KI_DOWN ,
  KI_R , KI_L , KI_MAX
}
 

Functions

void key_wait_for_clear (u32 key)
 
Basic synchonous keystates
void key_poll ()
 Poll for keystates and repeated keys.
 
INLINE u32 key_curr_state (void)
 Get current keystate.
 
INLINE u32 key_prev_state (void)
 Get previous key state.
 
INLINE u32 key_is_down (u32 key)
 Gives the keys of key that are currently down.
 
INLINE u32 key_is_up (u32 key)
 Gives the keys of key that are currently up.
 
INLINE u32 key_was_down (u32 key)
 Gives the keys of key that were previously down.
 
INLINE u32 key_was_up (u32 key)
 Gives the keys of key that were previously down.
 
Transitional keystates
INLINE u32 key_transit (u32 key)
 Gives the keys of key that are different from before.
 
INLINE u32 key_held (u32 key)
 Gives the keys of key that are being held down.
 
INLINE u32 key_hit (u32 key)
 Gives the keys of key that are pressed (down now but not before)
 
INLINE u32 key_released (u32 key)
 Gives the keys of key that are being released.
 
Tribools
INLINE int key_tri_horz (void)
 Horizontal tribool (right,left)=(+,-)
 
INLINE int key_tri_vert (void)
 Vertical tribool (down,up)=(+,-)
 
INLINE int key_tri_shoulder (void)
 Shoulder-button tribool (R,L)=(+,-)
 
INLINE int key_tri_fire (void)
 Fire-button tribool (A,B)=(+,-)
 
Key repeats
u32 key_repeat (u32 keys)
 Get status of repeated keys.
 
void key_repeat_mask (u32 mask)
 Set repeat mask. Only these keys will be considered for repeats.
 
void key_repeat_limits (uint delay, uint repeat)
 Set the delay and repeat limits for repeated keys.
 
void key_wait_till_hit (u16 key)
 Wait until key is hit.
 

Variables

u16 __key_curr
 
u16 __key_prev
 

Detailed Description

Author
J Vijn
Date
20060508 - 20070406