libtonc: Input

Tonclib

Input

Routines for synchronous and asynchronous button states. More...

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.

Defines

#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) )

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)
void key_wait_till_hit (u16 key)
 Wait until key is hit.

Variables

u16 __key_curr
u16 __key_prev

Detailed Description

Routines for synchronous and asynchronous button states.

For details, see tonc:keys.


Enumeration Type Documentation

enum eKeyIndex


Function Documentation

void key_repeat_limits ( uint  delay,
uint  repeat 
)

Set the delay and repeat limits for repeated keys.

Parameters:
delay Set first repeat limit. If 0, repeats are off.
repeat Sets later repeat limit.
Note:
Both limits have a range of [0, 255]. If either argument is <0, the old value will be kept.


Generated on Mon Aug 25 17:03:56 2008 for libtonc by  doxygen 1.5.3