Keys


Data Structures

union  UL_KEYLIST
struct  UL_CONTROLLER

Defines

#define ulSetKeyAutorepeat(keys, init, interval)   ( ul_keys.autoRepeatMask = keys, ul_keys.autoRepeatInit = init, ul_keys.autoRepeatInterval = interval )
#define ulSetKeyAutorepeatMask(mask)   (ul_keys.autoRepeatMask = mask)
#define ulSetKeyAutorepeatInit(value)   (ul_keys.autoRepeatInit = value)
#define ulSetKeyAutorepeatInterval(value)   (ul_keys.autoRepeatInterval = value)
#define ulSetTouchpadDoubleClickDelay(value)   (ul_keys.touch.doubleClickDelay = value)

Enumerations

enum  UL_KEYPAD_BITS {
  UL_KEY_A = 0x1, UL_KEY_B = 0x2, UL_KEY_SELECT = 0x4, UL_KEY_START = 0x8,
  UL_KEY_RIGHT = 0x10, UL_KEY_LEFT = 0x20, UL_KEY_UP = 0x40, UL_KEY_DOWN = 0x80,
  UL_KEY_R = 0x100, UL_KEY_L = 0x200, UL_KEY_X = 0x400, UL_KEY_Y = 0x800,
  UL_KEY_TOUCH = 0x1000, UL_KEY_LID = 0x2000
}

Functions

void ulReadKeys (int flags)

Variables

UL_CONTROLLER ul_keys

Detailed Description

Support for game keys and touchpad in µLibrary.

Define Documentation

#define ulSetKeyAutorepeat ( keys,
init,
interval   )     ( ul_keys.autoRepeatMask = keys, ul_keys.autoRepeatInit = init, ul_keys.autoRepeatInterval = interval )

Sets the key autorepeat features (all in one).

#define ulSetKeyAutorepeatMask ( mask   )     (ul_keys.autoRepeatMask = mask)

Sets the keymask for autorepeat: only keys present in this mask will be autorepeated.

#define ulSetKeyAutorepeatInit ( value   )     (ul_keys.autoRepeatInit = value)

Sets the delay for the autorepeat feature to be initialized. Keys left in their state for the defined delay (number of ulReadKeys state, so 60 should be equal to a second) will be thrown again in the pressed member. So, you only have to check the pressed member if you want to use that keys for a menu, for example. A typical value would be 30 (1/2 second).

#define ulSetKeyAutorepeatInterval ( value   )     (ul_keys.autoRepeatInterval = value)

Sets the rate at which keys will be repeated once the autorepeat has begun. A typical value could be 10 (6 times per second).

#define ulSetTouchpadDoubleClickDelay ( value   )     (ul_keys.touch.doubleClickDelay = value)

Sets the maximum delay for a double click on the touchpad to be taken in account. The default value is 30 (1/2 second).


Enumeration Type Documentation

enum UL_KEYPAD_BITS

Bit values for the keypad buttons.

Enumerator:
UL_KEY_A  Keypad A button.
UL_KEY_B  Keypad B button.
UL_KEY_SELECT  Keypad SELECT button.
UL_KEY_START  Keypad START button.
UL_KEY_RIGHT  Keypad RIGHT button.
UL_KEY_LEFT  Keypad LEFT button.
UL_KEY_UP  Keypad UP button.
UL_KEY_DOWN  Keypad DOWN button.
UL_KEY_R  Right shoulder button.
UL_KEY_L  Left shoulder button.
UL_KEY_X  Keypad X button.
UL_KEY_Y  Keypad Y button.
UL_KEY_TOUCH  Touchscreen pen down.
UL_KEY_LID  Lid state.


Function Documentation

void ulReadKeys ( int  flags  ) 

Reads the keypad and touchpad state.

Parameters:
flags Let it to 0 for now.
If you want to use the µLibrary keypad system, you need to call this function once per frame (else autorepeat and double-click feature won't work). That is, 60 times per second.

The result is placed into the ul_keys system variable. You can then read from it. Examples:

ulReadKeys(0);
if (ul_keys.held.down)
        //down key is held


Variable Documentation

UL_CONTROLLER ul_keys

Contains the default controller state read by ulReadKeys.


Generated on Sat Jul 14 23:39:33 2007 by  doxygen 1.5.2