Input

The output of the input methods is guaranteed to remain the same for the entire frame. Currently supports up to 32 mouse buttons, and 256 keyboard buttons.

Types

enum KeyCode
An enum for the USB HID codes

typedef enum  KeyCode{
KeyCode_A                    = 0x00,
KeyCode_S                    = 0x01,
KeyCode_D                    = 0x02,
KeyCode_F                    = 0x03,
KeyCode_H                    = 0x04,
KeyCode_G                    = 0x05,
KeyCode_Z                    = 0x06,
KeyCode_X                    = 0x07,
KeyCode_C                    = 0x08,
KeyCode_V                    = 0x09,
KeyCode_B                    = 0x0B,
KeyCode_Q                    = 0x0C,
KeyCode_W                    = 0x0D,
KeyCode_E                    = 0x0E,
KeyCode_R                    = 0x0F,
KeyCode_Y                    = 0x10,
KeyCode_T                    = 0x11,
KeyCode_Alpha1               = 0x12,
KeyCode_Alpha2               = 0x13,
KeyCode_Alpha3               = 0x14,
KeyCode_Alpha4               = 0x15,
KeyCode_Alpha6               = 0x16,
KeyCode_Alpha5               = 0x17,
KeyCode_Equal                = 0x18,
KeyCode_Alpha9               = 0x19,
KeyCode_Alpha7               = 0x1A,
KeyCode_Minus                = 0x1B,
KeyCode_Alpha8               = 0x1C,
KeyCode_Alpha0               = 0x1D,
KeyCode_RightBracket         = 0x1E,
KeyCode_O                    = 0x1F,
KeyCode_U                    = 0x20,
KeyCode_LeftBracket          = 0x21,
KeyCode_I                    = 0x22,
KeyCode_P                    = 0x23,
KeyCode_L                    = 0x25,
KeyCode_J                    = 0x26,
KeyCode_Quote                = 0x27,
KeyCode_K                    = 0x28,
KeyCode_Semicolon            = 0x29,
KeyCode_Backslash            = 0x2A,
KeyCode_Comma                = 0x2B,
KeyCode_Slash                = 0x2C,
KeyCode_N                    = 0x2D,
KeyCode_M                    = 0x2E,
KeyCode_Period               = 0x2F,
KeyCode_Grave                = 0x32,
KeyCode_KeypadDecimal        = 0x41,
KeyCode_KeypadMultiply       = 0x43,
KeyCode_KeypadPlus           = 0x45,
KeyCode_KeypadClear          = 0x47,
KeyCode_KeypadDivide         = 0x4B,
KeyCode_KeypadEnter          = 0x4C,
KeyCode_KeypadMinus          = 0x4E,
KeyCode_KeypadEquals         = 0x51,
KeyCode_Keypad0              = 0x52,
KeyCode_Keypad1              = 0x53,
KeyCode_Keypad2              = 0x54,
KeyCode_Keypad3              = 0x55,
KeyCode_Keypad4              = 0x56,
KeyCode_Keypad5              = 0x57,
KeyCode_Keypad6              = 0x58,
KeyCode_Keypad7              = 0x59,
KeyCode_Keypad8              = 0x5B,
KeyCode_Keypad9              = 0x5C,  
/* Independent Keycodes */
KeyCode_Return                    = 0x24,
KeyCode_Tab                       = 0x30,
KeyCode_Space                     = 0x31,
KeyCode_Delete                    = 0x33,
KeyCode_Escape                    = 0x35,
KeyCode_RightCommand              = 0x36,
KeyCode_LeftCommand               = 0x37,//55
KeyCode_LeftShift                 = 0x38,//56
KeyCode_CapsLock                  = 0x39,//57
KeyCode_LeftOption                = 0x3A,//58
KeyCode_LeftControl               = 0x3B,//59
KeyCode_RightShift                = 0x3C,//60
KeyCode_RightOption               = 0x3D,
KeyCode_RightControl              = 0x3E,
KeyCode_Function                  = 0x3F,
KeyCode_F17                       = 0x40,
KeyCode_VolumeUp                  = 0x48,
KeyCode_VolumeDown                = 0x49,
KeyCode_Mute                      = 0x4A,
KeyCode_F18                       = 0x4F,
KeyCode_F19                       = 0x50,
KeyCode_F20                       = 0x5A,
KeyCode_F5                        = 0x60,
KeyCode_F6                        = 0x61,
KeyCode_F7                        = 0x62,
KeyCode_F3                        = 0x63,
KeyCode_F8                        = 0x64,
KeyCode_F9                        = 0x65,
KeyCode_F11                       = 0x67,
KeyCode_F13                       = 0x69,
KeyCode_F16                       = 0x6A,
KeyCode_F14                       = 0x6B,
KeyCode_F10                       = 0x6D,
KeyCode_F12                       = 0x6F,
KeyCode_F15                       = 0x71,
KeyCode_Help                      = 0x72,
KeyCode_Home                      = 0x73,
KeyCode_PageUp                    = 0x74,
KeyCode_ForwardDelete             = 0x75,
KeyCode_F4                        = 0x76,
KeyCode_End                       = 0x77,
KeyCode_F2                        = 0x78,
KeyCode_PageDown                  = 0x79,
KeyCode_F1                        = 0x7A,
KeyCode_LeftArrow                 = 0x7B,
KeyCode_RightArrow                = 0x7C,
KeyCode_DownArrow                 = 0x7D,
KeyCode_UpArrow                   = 0x7E,
KeyCode_ISO_Section               = 0x0A,
KeyCode_JYen                  	 	= 0x5D,
KeyCode_JUnderscore           		= 0x5E,
KeyCode_JKeypadComma          		= 0x5F,
KeyCode_JEisu                  		= 0x66,
KeyCode_JKana                  		= 0x68  
} KeyCode;

Functions

Input_GetMousePosition( void ) : Float2
Returns the mouse position at the start of the frame.

Input_GetMouseDelta( void ) : Float2
Returns the mouse delta postion from the start of last frame to the start of the current frame.

Input_GetMouseButton( uint32_t button_id ) : bool
Returns the state of the mouse button at the start of the frame, e.g true if pressed, false if not pressed. Default is false. If a button does not exist, this returns false.

Input_GetMouseButtonDown( uint32_t button_id ) : bool
Returns true if a down event occured for the specified button last frame. NOTE: it is possible for both a down and up event to occur in the same frame, in which case both will return true.

Input_GetMouseButtonUp( uint32_t button_id ) : bool
Returns true if an up event occured for the specified button last frame. NOTE: it is possible for both a down and up event to occur in the same frame, in which case both will return true.

Input_GetMouseScrollX( void ) : float
Returns the total amount of mouse scrollwheel x motion from last frame.

Input_GetMouseScrollY( void ) : float
Returns the total amount of mouse scrollwheel y motion from last frame.

Input_GetKey( KeyCode key ) : bool
Returns the state of the keyboard button at the start of the frame, e.g true if pressed, false if not pressed. Default is false. If a button does not exist, this returns false.

Input_GetKeyDown( KeyCode key ) : bool
Returns true if a down event occured for the specified button last frame. NOTE: it is possible for both a down and up event to occur in the same frame, in which case both will return true.

Input_GetKeyUp( KeyCode key ) : bool
Returns true if an up event occured for the specified button last frame. NOTE: it is possible for both a down and up event to occur in the same frame, in which case both will return true.