Files
Aerofoil/GpCommon/GpVOSEvent.h

317 lines
4.5 KiB
C
Raw Normal View History

2019-12-21 18:40:17 -05:00
#pragma once
2019-12-25 22:20:10 -05:00
#include <stdint.h>
2019-12-24 02:35:24 -05:00
namespace GpKeyModifiers
{
enum GpKeyModifier
{
kShift,
kCtrl,
};
}
2019-12-21 18:40:17 -05:00
namespace GpKeyIDSubsets
{
enum GpKeyIDSubset
{
kASCII,
2019-12-25 22:20:10 -05:00
kUnicode,
2019-12-21 18:40:17 -05:00
kSpecial,
2019-12-25 22:20:10 -05:00
kNumPadNumber,
2019-12-21 18:40:17 -05:00
kNumPadSpecial,
kFKey, // Key value is a raw F number
2019-12-29 17:39:19 -05:00
kGamepadButton,
kCount,
2019-12-25 22:20:10 -05:00
};
2019-12-21 18:40:17 -05:00
}
typedef GpKeyIDSubsets::GpKeyIDSubset GpKeyIDSubset_t;
2019-12-29 17:39:19 -05:00
namespace GpGamepadButtons
{
enum GpGamepadButton
{
kDPadUp,
kDPadDown,
kDPadLeft,
kDPadRight,
kFaceUp,
kFaceDown,
kFaceLeft,
kFaceRight,
kLeftStick,
kRightStick,
kLeftBumper,
kRightBumper,
kMisc1,
kMisc2,
kCount,
};
}
typedef GpGamepadButtons::GpGamepadButton GpGamepadButton_t;
namespace GpGamepadAxes
{
enum GpGamepadAxis
{
kLeftStickX,
kLeftStickY,
kRightStickX,
kRightStickY,
kLeftTrigger,
kRightTrigger,
kCount,
};
}
typedef GpGamepadAxes::GpGamepadAxis GpGamepadAxis_t;
2019-12-21 18:40:17 -05:00
namespace GpKeySpecials
{
enum GpKeySpecial
{
2019-12-25 22:20:10 -05:00
kTab,
2019-12-21 18:40:17 -05:00
kEscape,
kPrintScreen,
kScrollLock,
kPause,
kInsert,
kHome,
kPageUp,
kPageDown,
kDelete,
kEnd,
kBackspace,
kCapsLock,
kEnter,
kLeftShift,
kRightShift,
2021-08-08 16:43:46 +10:00
kLeftCtrl,
kRightCtrl,
2019-12-21 18:40:17 -05:00
kLeftAlt,
kRightAlt,
2021-08-02 01:04:22 -04:00
kLeftCommand,
kRightCommand,
2019-12-21 18:40:17 -05:00
kNumLock,
2019-12-25 22:20:10 -05:00
kLeftArrow,
kUpArrow,
kDownArrow,
kRightArrow,
kCount,
2019-12-21 18:40:17 -05:00
};
}
typedef GpKeySpecials::GpKeySpecial GpKeySpecial_t;
2019-12-25 22:20:10 -05:00
namespace GpNumPadSpecials
{
enum GpNumPadSpecial
{
kSlash,
kAsterisk,
kMinus,
kPlus,
2020-09-28 17:38:39 -04:00
kPeriod,
kComma,
2019-12-25 22:20:10 -05:00
kCount,
};
}
typedef GpNumPadSpecials::GpNumPadSpecial GpNumPadSpecial_t;
2019-12-24 02:35:24 -05:00
namespace GpKeyboardInputEventTypes
2019-12-21 18:40:17 -05:00
{
2019-12-24 02:35:24 -05:00
enum GpKeyboardInputEventType
2019-12-21 18:40:17 -05:00
{
kDown,
kUp,
kAuto,
kDownChar,
kAutoChar,
2019-12-21 18:40:17 -05:00
};
}
2019-12-24 02:35:24 -05:00
typedef GpKeyboardInputEventTypes::GpKeyboardInputEventType GpKeyboardInputEventType_t;
2019-12-21 18:40:17 -05:00
2019-12-29 17:39:19 -05:00
namespace GpGamepadInputEventTypes
{
enum GpGamepadInputEventType
{
kAnalogAxisChanged,
};
}
typedef GpGamepadInputEventTypes::GpGamepadInputEventType GpGamepadInputEventTypes_t;
struct GpGamepadButtonAndPlayer
{
GpGamepadButton_t m_button;
uint8_t m_player;
};
2019-12-24 02:35:24 -05:00
struct GpKeyboardInputEvent
2019-12-21 18:40:17 -05:00
{
2019-12-24 02:35:24 -05:00
union KeyUnion
2019-12-21 18:40:17 -05:00
{
2019-12-25 22:20:10 -05:00
GpKeySpecial_t m_specialKey;
GpNumPadSpecial_t m_numPadSpecialKey;
uint8_t m_numPadNumber;
2019-12-24 02:35:24 -05:00
char m_asciiChar;
2019-12-25 22:20:10 -05:00
uint32_t m_unicodeChar;
unsigned char m_fKey;
2019-12-29 17:39:19 -05:00
GpGamepadButtonAndPlayer m_gamepadKey;
2019-12-24 02:35:24 -05:00
};
GpKeyboardInputEventType_t m_eventType;
GpKeyIDSubset_t m_keyIDSubset;
KeyUnion m_key;
uint32_t m_repeatCount; // For down and auto events, number of types to repeat this keystroke (if multiple auto-repeated events get compacted)
2019-12-24 02:35:24 -05:00
};
2019-12-29 17:39:19 -05:00
struct GpGamepadAnalogAxisEvent
{
GpGamepadAxis_t m_axis;
int16_t m_state; // Ranges from -32767 to 32767, is never -32768
uint8_t m_player;
};
struct GpGamepadInputEvent
{
union EventUnion
{
GpGamepadAnalogAxisEvent m_analogAxisEvent;
};
GpGamepadInputEventTypes_t m_eventType;
EventUnion m_event;
};
2019-12-24 02:35:24 -05:00
namespace GpMouseEventTypes
{
enum GpMouseEventType
{
kUp,
kDown,
kMove,
kLeave,
2019-12-21 18:40:17 -05:00
};
}
2019-12-24 02:35:24 -05:00
typedef GpMouseEventTypes::GpMouseEventType GpMouseEventType_t;
2019-12-21 18:40:17 -05:00
2019-12-24 02:35:24 -05:00
namespace GpMouseButtons
2019-12-21 18:40:17 -05:00
{
2019-12-24 02:35:24 -05:00
enum GpMouseButton
2019-12-21 18:40:17 -05:00
{
2019-12-24 02:35:24 -05:00
kNone,
kLeft,
kMiddle,
kRight,
kX1,
kX2,
2020-02-25 23:09:09 -05:00
kCount
2019-12-21 18:40:17 -05:00
};
2019-12-24 02:35:24 -05:00
}
2019-12-21 18:40:17 -05:00
2019-12-24 02:35:24 -05:00
typedef GpMouseButtons::GpMouseButton GpMouseButton_t;
struct GpMouseInputEvent
{
int32_t m_x;
int32_t m_y;
GpMouseEventType_t m_eventType;
GpMouseButton_t m_button;
2019-12-21 18:40:17 -05:00
};
2020-10-14 18:12:02 -04:00
namespace GpTouchEventTypes
{
enum GpTouchEventType
{
kUp,
kDown,
kMove,
kLeave,
};
}
typedef GpTouchEventTypes::GpTouchEventType GpTouchEventType_t;
struct GpTouchInputEvent
{
int32_t m_x;
int32_t m_y;
int64_t m_deviceID;
int64_t m_fingerID;
GpTouchEventType_t m_eventType;
};
2020-04-01 14:53:44 -04:00
struct GpVideoResolutionChangedEvent
{
uint32_t m_prevWidth;
uint32_t m_prevHeight;
uint32_t m_newWidth;
uint32_t m_newHeight;
};
namespace GpMenuItemSelectionEvents
{
enum GpMenuItemSelectionEvent {
kAboutGliderPRO,
kAboutAerofoil,
kPreferences
};
}
typedef GpMenuItemSelectionEvents::GpMenuItemSelectionEvent GpMenuItemSelectionEvent_t;
2019-12-24 02:35:24 -05:00
namespace GpVOSEventTypes
{
enum GpVOSEventType
{
kKeyboardInput,
kMouseInput,
2020-10-14 18:12:02 -04:00
kTouchInput,
2019-12-29 17:39:19 -05:00
kGamepadInput,
2020-04-01 14:53:44 -04:00
kVideoResolutionChanged,
kMenuItemSelected,
2020-04-18 05:51:39 -04:00
kQuit
2019-12-24 02:35:24 -05:00
};
}
typedef GpVOSEventTypes::GpVOSEventType GpVOSEventType_t;
2019-12-21 18:40:17 -05:00
struct GpVOSEvent
{
union EventUnion
{
2019-12-24 02:35:24 -05:00
GpKeyboardInputEvent m_keyboardInputEvent;
GpMouseInputEvent m_mouseInputEvent;
2020-10-14 18:12:02 -04:00
GpTouchInputEvent m_touchInputEvent;
2019-12-29 17:39:19 -05:00
GpGamepadInputEvent m_gamepadInputEvent;
2020-04-01 14:53:44 -04:00
GpVideoResolutionChangedEvent m_resolutionChangedEvent;
GpMenuItemSelectionEvent_t m_menuItemSelectionEvent;
2019-12-21 18:40:17 -05:00
};
2019-12-24 02:35:24 -05:00
EventUnion m_event;
2019-12-21 18:40:17 -05:00
GpVOSEventType_t m_eventType;
};
2019-12-25 22:20:10 -05:00
static const unsigned int GpFKeyMaximumInclusive = 24;