Kobold2D  2.0
Kobold2D API Reference (iOS version) for www.kobold2d.com developers
 All Classes Files Functions Variables Enumerations Enumerator Properties Macros
KKInputEnums.h File Reference

Enumerations

enum  KKSwipeGestureDirection
 
enum  KKTouchPhase {
  KKTouchPhaseBegan, KKTouchPhaseMoved, KKTouchPhaseStationary, KKTouchPhaseEnded,
  KKTouchPhaseCancelled, KKTouchPhaseAny, KKTouchPhaseLifted
}
 
enum  KKModifierFlag {
  KKModifierAlphaShiftKeyMask = 1 << 16 , KKModifierAlternateKeyMask = 1 << 19 , KKModifierNumericPadKeyMask = 1 << 21 , KKModifierFunctionKeyMask = 1 << 23,
  KKDeviceIndependentModifierFlagsMask = 0xffff0000UL
}
 
enum  KKKeyCode { , KKKeyCode_ISO_Section = 0x0A, KKKeyCode_JIS_Yen = 0x5D }
 
enum  KKMouseButtonCode { , KKMouseButtonOther, KKMouseButtonDoubleClickOffset = 0x1F }
 

Enumeration Type Documentation

enum KKKeyCode

The virtual key codes for all keyboard keys, including modifier keys like Control, Command, Shift, etc.

Enumerator:
KKKeyCode_ISO_Section 

ISO keyboards only

KKKeyCode_JIS_Yen 

JIS keyboards only (this one and following)

The modifier flags (bits) for special keyboard keys, like Shift, Control, Option, Command, Function, Help, etc.

Enumerator:
KKModifierAlphaShiftKeyMask 

Caps Lock

KKModifierAlternateKeyMask 

Option

KKModifierNumericPadKeyMask 

Set if a numeric keypad key is pressed

KKModifierFunctionKeyMask 

Set if any function key (F1, F2, etc) is pressed

KKDeviceIndependentModifierFlagsMask 

Keyboard modifier keys are bits 16 to 23. Sometimes other bits (0-15) may be set as well, depending on the device. According to Apple: "Used to retrieve only the device-independent modifier flags, allowing applications to mask off the device-dependent modifier flags, including event coalescing information." Use the following code to mask out the device-dependent flags:

UInt32 flags = eventModifierFlags & kKKDeviceIndependentModifierFlagsMask;

The "virtual keyCodes" for mouse buttons. These are left, right and other. The "other" buttons may include multiple keys which, if supported by the hardware and driver, you can identify with kKKMouseButtonOther and an optional offset, eg "kKKMouseButtonOther + 2" for a fifth mouse button. Note that any of the "other" mouse buttons are non-standard and typically require non-Apple mice to work. You can not rely on any of the "other" buttons being available at all.

Mouse double-clicks are an offset (kKKMouseButtonDoubleClickOffset) to the button codes. Double-clicks are treated as separate buttons by KKInput for your convenience, ie you don't have to test for two consecutive mouse button presses.

Enumerator:
KKMouseButtonOther 

Third mouse button, and other mouse buttons by adding offset: kKKMouseButtonOther + n

KKMouseButtonDoubleClickOffset 

Mouse button double clicks are treated as seperate key codes with this offset: kKKMouseButtonLeft + kKKMouseButtonDoubleClickOffset == kKKMouseButtonDoubleClickLeft

Direction bits for the swipe gesture relative are relative to the current device orientation.

A touch can have just began, it can be moving, or it can be ended this frame. The kKKTouchPhaseAny can be used if want to include all three phases in a touch test. The KKTouchPhase enum values are equal to those in the UITouchPhase enum (except for any and lifted), that means they can be used interchangeably.

Enumerator:
KKTouchPhaseBegan 

touch began this frame

KKTouchPhaseMoved 

touch has moved this frame

KKTouchPhaseStationary 

touch didn't move this frame

KKTouchPhaseEnded 

touch ended this frame

KKTouchPhaseCancelled 

touch was cancelled (ie incoming call, incoming SMS, etc) this frame

KKTouchPhaseAny 

used for certain tests to disregard the phase of the touch

KKTouchPhaseLifted 

a touch is "lifted" if it is no longer associated with a finger on the screen