22 #ifndef AGS_SHARED_AC_KEYCODE_H 23 #define AGS_SHARED_AC_KEYCODE_H 25 #include "ags/shared/core/platform.h" 26 #include "ags/shared/core/types.h" 30 #define EXTENDED_KEY_CODE ('\0') 31 #define EXTENDED_KEY_CODE_MACOS ('?') 34 #define AGS_EXT_KEY_SHIFT 300 35 #define AGS_EXT_KEY_ALPHA(key) (AGS_EXT_KEY_SHIFT + (key - eAGSKeyCodeCtrlA) + 1) 61 eAGSKeyCodeCtrlJ = 10,
62 eAGSKeyCodeCtrlK = 11,
63 eAGSKeyCodeCtrlL = 12,
64 eAGSKeyCodeCtrlM = 13,
65 eAGSKeyCodeCtrlN = 14,
66 eAGSKeyCodeCtrlO = 15,
67 eAGSKeyCodeCtrlP = 16,
68 eAGSKeyCodeCtrlQ = 17,
69 eAGSKeyCodeCtrlR = 18,
70 eAGSKeyCodeCtrlS = 19,
71 eAGSKeyCodeCtrlT = 20,
72 eAGSKeyCodeCtrlU = 21,
73 eAGSKeyCodeCtrlV = 22,
74 eAGSKeyCodeCtrlW = 23,
75 eAGSKeyCodeCtrlX = 24,
76 eAGSKeyCodeCtrlY = 25,
77 eAGSKeyCodeCtrlZ = 26,
79 eAGSKeyCodeBackspace = 8,
81 eAGSKeyCodeReturn = 13,
82 eAGSKeyCodeEscape = 27,
85 eAGSKeyCodeSpace = 32,
86 eAGSKeyCodeExclamationMark = 33,
87 eAGSKeyCodeDoubleQuote = 34,
89 eAGSKeyCodeDollar = 36,
90 eAGSKeyCodePercent = 37,
91 eAGSKeyCodeAmpersand = 38,
92 eAGSKeyCodeSingleQuote = 39,
93 eAGSKeyCodeOpenParenthesis = 40,
94 eAGSKeyCodeCloseParenthesis = 41,
95 eAGSKeyCodeAsterisk = 42,
97 eAGSKeyCodeComma = 44,
98 eAGSKeyCodeHyphen = 45,
99 eAGSKeyCodePeriod = 46,
100 eAGSKeyCodeForwardSlash = 47,
113 eAGSKeyCodeColon = 58,
114 eAGSKeyCodeSemiColon = 59,
115 eAGSKeyCodeLessThan = 60,
116 eAGSKeyCodeEquals = 61,
117 eAGSKeyCodeGreaterThan = 62,
118 eAGSKeyCodeQuestionMark = 63,
149 eAGSKeyCodeOpenBracket = 91,
150 eAGSKeyCodeBackSlash = 92,
151 eAGSKeyCodeCloseBracket = 93,
152 eAGSKeyCodeCaret = 94,
153 eAGSKeyCodeUnderscore = 95,
154 eAGSKeyCodeBackquote = 96,
185 eAGSKeyCodeF1 = AGS_EXT_KEY_SHIFT + 59,
186 eAGSKeyCodeF2 = AGS_EXT_KEY_SHIFT + 60,
187 eAGSKeyCodeF3 = AGS_EXT_KEY_SHIFT + 61,
188 eAGSKeyCodeF4 = AGS_EXT_KEY_SHIFT + 62,
189 eAGSKeyCodeF5 = AGS_EXT_KEY_SHIFT + 63,
190 eAGSKeyCodeF6 = AGS_EXT_KEY_SHIFT + 64,
191 eAGSKeyCodeF7 = AGS_EXT_KEY_SHIFT + 65,
192 eAGSKeyCodeF8 = AGS_EXT_KEY_SHIFT + 66,
193 eAGSKeyCodeF9 = AGS_EXT_KEY_SHIFT + 67,
194 eAGSKeyCodeF10 = AGS_EXT_KEY_SHIFT + 68,
195 eAGSKeyCodeF11 = AGS_EXT_KEY_SHIFT + 133,
196 eAGSKeyCodeF12 = AGS_EXT_KEY_SHIFT + 134,
198 eAGSKeyCodeHome = AGS_EXT_KEY_SHIFT + 71,
199 eAGSKeyCodeUpArrow = AGS_EXT_KEY_SHIFT + 72,
200 eAGSKeyCodePageUp = AGS_EXT_KEY_SHIFT + 73,
201 eAGSKeyCodeLeftArrow = AGS_EXT_KEY_SHIFT + 75,
202 eAGSKeyCodeNumPad5 = AGS_EXT_KEY_SHIFT + 76,
203 eAGSKeyCodeRightArrow = AGS_EXT_KEY_SHIFT + 77,
204 eAGSKeyCodeEnd = AGS_EXT_KEY_SHIFT + 79,
205 eAGSKeyCodeDownArrow = AGS_EXT_KEY_SHIFT + 80,
206 eAGSKeyCodePageDown = AGS_EXT_KEY_SHIFT + 81,
207 eAGSKeyCodeInsert = AGS_EXT_KEY_SHIFT + 82,
208 eAGSKeyCodeDelete = AGS_EXT_KEY_SHIFT + 83,
212 eAGSKeyCodeAltV = AGS_EXT_KEY_ALPHA(eAGSKeyCodeV),
213 eAGSKeyCodeAltX = AGS_EXT_KEY_ALPHA(eAGSKeyCodeX),
214 eAGSKeyCodeAltY = AGS_EXT_KEY_ALPHA(eAGSKeyCodeY),
215 eAGSKeyCodeAltZ = AGS_EXT_KEY_ALPHA(eAGSKeyCodeZ),
219 eAGSKeyCode_FirstServiceKey = 391,
222 eAGSKeyCodeAltTab = AGS_EXT_KEY_SHIFT + 99,
226 eAGSKeyCodeLShift = 403,
227 eAGSKeyCodeRShift = 404,
228 eAGSKeyCodeLCtrl = 405,
229 eAGSKeyCodeRCtrl = 406,
230 eAGSKeyCodeLAlt = 407,
235 eAGSKeyCodeRAlt = 420,
265 eAGSModLShift = 0x00010000,
266 eAGSModRShift = 0x00020000,
267 eAGSModLCtrl = 0x00040000,
268 eAGSModRCtrl = 0x00080000,
269 eAGSModLAlt = 0x00100000,
270 eAGSModRAlt = 0x00200000,
271 eAGSModNum = 0x00400000,
272 eAGSModCaps = 0x00800000,
277 eAGSModMask = 0x00FF0000
282 const static size_t UTF8_ARR_SIZE = 5;
284 eAGSKeyCode Key = eAGSKeyCodeNone;
285 eAGSKeyCode CompatKey = eAGSKeyCodeNone;
288 char Text[UTF8_ARR_SIZE]{};
305 inline bool IsAGSModKey(eAGSKeyCode keycode) {
306 return (keycode >= eAGSKeyCodeLShift && keycode <= eAGSKeyCodeLAlt) || keycode == eAGSKeyCodeRAlt;
311 inline bool IsAGSServiceKey(eAGSKeyCode keycode) {
312 return keycode >= eAGSKeyCode_FirstServiceKey;
316 eAGSKeyCode AGSKeyToScriptKey(eAGSKeyCode keycode);
319 char AGSKeyToText(eAGSKeyCode keycode);