1/**************************************************************************/
2/* core_constants.cpp */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#include "core_constants.h"
32
33#include "core/input/input_event.h"
34#include "core/object/class_db.h"
35#include "core/os/keyboard.h"
36#include "core/templates/hash_set.h"
37#include "core/variant/variant.h"
38
39struct _CoreConstant {
40#ifdef DEBUG_METHODS_ENABLED
41 bool ignore_value_in_docs = false;
42 bool is_bitfield = false;
43#endif
44 StringName enum_name;
45 const char *name = nullptr;
46 int64_t value = 0;
47
48 _CoreConstant() {}
49
50#ifdef DEBUG_METHODS_ENABLED
51 _CoreConstant(const StringName &p_enum_name, const char *p_name, int64_t p_value, bool p_ignore_value_in_docs = false, bool p_is_bitfield = false) :
52 ignore_value_in_docs(p_ignore_value_in_docs),
53 is_bitfield(p_is_bitfield),
54 enum_name(p_enum_name),
55 name(p_name),
56 value(p_value) {
57 }
58#else
59 _CoreConstant(const StringName &p_enum_name, const char *p_name, int64_t p_value) :
60 enum_name(p_enum_name),
61 name(p_name),
62 value(p_value) {
63 }
64#endif
65};
66
67static Vector<_CoreConstant> _global_constants;
68static HashMap<StringName, int> _global_constants_map;
69static HashMap<StringName, Vector<_CoreConstant>> _global_enums;
70
71#ifdef DEBUG_METHODS_ENABLED
72
73#define BIND_CORE_CONSTANT(m_constant) \
74 _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \
75 _global_constants_map[#m_constant] = _global_constants.size() - 1;
76
77#define BIND_CORE_ENUM_CONSTANT(m_constant) \
78 { \
79 StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
80 _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
81 _global_constants_map[#m_constant] = _global_constants.size() - 1; \
82 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
83 }
84
85#define BIND_CORE_BITFIELD_FLAG(m_constant) \
86 { \
87 StringName enum_name = __constant_get_bitfield_name(m_constant, #m_constant); \
88 _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, false, true)); \
89 _global_constants_map[#m_constant] = _global_constants.size() - 1; \
90 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
91 }
92
93// This just binds enum classes as if they were regular enum constants.
94#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \
95 { \
96 StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \
97 _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
98 _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
99 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
100 }
101
102#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \
103 { \
104 StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_prefix "_" #m_member); \
105 _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, false, true)); \
106 _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
107 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
108 }
109
110#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \
111 { \
112 StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_name); \
113 _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
114 _global_constants_map[#m_name] = _global_constants.size() - 1; \
115 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
116 }
117
118#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \
119 { \
120 StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_name); \
121 _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member, false, true)); \
122 _global_constants_map[#m_name] = _global_constants.size() - 1; \
123 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
124 }
125
126#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \
127 { \
128 StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \
129 _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member, true)); \
130 _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
131 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
132 }
133
134#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
135 { \
136 StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
137 _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
138 _global_constants_map[m_custom_name] = _global_constants.size() - 1; \
139 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
140 }
141
142#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \
143 _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant, true)); \
144 _global_constants_map[#m_constant] = _global_constants.size() - 1;
145
146#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \
147 { \
148 StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
149 _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant, true)); \
150 _global_constants_map[#m_constant] = _global_constants.size() - 1; \
151 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
152 }
153
154#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
155 { \
156 StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
157 _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant, true)); \
158 _global_constants_map[m_custom_name] = _global_constants.size() - 1; \
159 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
160 }
161
162#else
163
164#define BIND_CORE_CONSTANT(m_constant) \
165 _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \
166 _global_constants_map[#m_constant] = _global_constants.size() - 1;
167
168#define BIND_CORE_ENUM_CONSTANT(m_constant) \
169 { \
170 StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
171 _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
172 _global_constants_map[#m_constant] = _global_constants.size() - 1; \
173 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
174 }
175
176#define BIND_CORE_BITFIELD_FLAG(m_constant) \
177 { \
178 StringName enum_name = __constant_get_bitfield_name(m_constant, #m_constant); \
179 _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
180 _global_constants_map[#m_constant] = _global_constants.size() - 1; \
181 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
182 }
183
184// This just binds enum classes as if they were regular enum constants.
185#define BIND_CORE_ENUM_CLASS_CONSTANT(m_enum, m_prefix, m_member) \
186 { \
187 StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \
188 _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
189 _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
190 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
191 }
192
193#define BIND_CORE_BITFIELD_CLASS_FLAG(m_enum, m_prefix, m_member) \
194 { \
195 StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_prefix "_" #m_member); \
196 _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
197 _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
198 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
199 }
200
201#define BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(m_enum, m_name, m_member) \
202 { \
203 StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_name); \
204 _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
205 _global_constants_map[#m_name] = _global_constants.size() - 1; \
206 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
207 }
208
209#define BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(m_enum, m_name, m_member) \
210 { \
211 StringName enum_name = __constant_get_bitfield_name(m_enum::m_member, #m_name); \
212 _global_constants.push_back(_CoreConstant(enum_name, #m_name, (int64_t)m_enum::m_member)); \
213 _global_constants_map[#m_name] = _global_constants.size() - 1; \
214 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
215 }
216
217#define BIND_CORE_ENUM_CLASS_CONSTANT_NO_VAL(m_enum, m_prefix, m_member) \
218 { \
219 StringName enum_name = __constant_get_enum_name(m_enum::m_member, #m_prefix "_" #m_member); \
220 _global_constants.push_back(_CoreConstant(enum_name, #m_prefix "_" #m_member, (int64_t)m_enum::m_member)); \
221 _global_constants_map[#m_prefix "_" #m_member] = _global_constants.size() - 1; \
222 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
223 }
224
225#define BIND_CORE_ENUM_CONSTANT_CUSTOM(m_custom_name, m_constant) \
226 { \
227 StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
228 _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
229 _global_constants_map[m_custom_name] = _global_constants.size() - 1; \
230 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
231 }
232
233#define BIND_CORE_CONSTANT_NO_VAL(m_constant) \
234 _global_constants.push_back(_CoreConstant(StringName(), #m_constant, m_constant)); \
235 _global_constants_map[#m_constant] = _global_constants.size() - 1;
236
237#define BIND_CORE_ENUM_CONSTANT_NO_VAL(m_constant) \
238 { \
239 StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
240 _global_constants.push_back(_CoreConstant(enum_name, #m_constant, m_constant)); \
241 _global_constants_map[#m_constant] = _global_constants.size() - 1; \
242 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
243 }
244
245#define BIND_CORE_ENUM_CONSTANT_CUSTOM_NO_VAL(m_custom_name, m_constant) \
246 { \
247 StringName enum_name = __constant_get_enum_name(m_constant, #m_constant); \
248 _global_constants.push_back(_CoreConstant(enum_name, m_custom_name, m_constant)); \
249 _global_constants_map[m_custom_name] = _global_constants.size() - 1; \
250 _global_enums[enum_name].push_back((_global_constants.ptr())[_global_constants.size() - 1]); \
251 }
252
253#endif
254
255void register_global_constants() {
256 BIND_CORE_ENUM_CONSTANT(SIDE_LEFT);
257 BIND_CORE_ENUM_CONSTANT(SIDE_TOP);
258 BIND_CORE_ENUM_CONSTANT(SIDE_RIGHT);
259 BIND_CORE_ENUM_CONSTANT(SIDE_BOTTOM);
260
261 BIND_CORE_ENUM_CONSTANT(CORNER_TOP_LEFT);
262 BIND_CORE_ENUM_CONSTANT(CORNER_TOP_RIGHT);
263 BIND_CORE_ENUM_CONSTANT(CORNER_BOTTOM_RIGHT);
264 BIND_CORE_ENUM_CONSTANT(CORNER_BOTTOM_LEFT);
265
266 BIND_CORE_ENUM_CONSTANT(VERTICAL);
267 BIND_CORE_ENUM_CONSTANT(HORIZONTAL);
268
269 BIND_CORE_ENUM_CONSTANT(CLOCKWISE);
270 BIND_CORE_ENUM_CONSTANT(COUNTERCLOCKWISE);
271
272 BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_LEFT);
273 BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_CENTER);
274 BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_RIGHT);
275 BIND_CORE_ENUM_CONSTANT(HORIZONTAL_ALIGNMENT_FILL);
276
277 BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_TOP);
278 BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_CENTER);
279 BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_BOTTOM);
280 BIND_CORE_ENUM_CONSTANT(VERTICAL_ALIGNMENT_FILL);
281
282 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TOP_TO);
283 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_CENTER_TO);
284 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_BASELINE_TO);
285 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_BOTTOM_TO);
286
287 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_TOP);
288 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_CENTER);
289 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_BASELINE);
290 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TO_BOTTOM);
291
292 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TOP);
293 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_CENTER);
294 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_BOTTOM);
295
296 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_IMAGE_MASK);
297 BIND_CORE_ENUM_CONSTANT(INLINE_ALIGNMENT_TEXT_MASK);
298
299 BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, XYZ);
300 BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, XZY);
301 BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, YXZ);
302 BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, YZX);
303 BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, ZXY);
304 BIND_CORE_ENUM_CLASS_CONSTANT(EulerOrder, EULER_ORDER, ZYX);
305
306 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NONE);
307 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SPECIAL);
308 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ESCAPE);
309 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, TAB);
310 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKTAB);
311 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKSPACE);
312 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ENTER);
313 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_ENTER);
314 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, INSERT);
315 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_DELETE, KEY_DELETE);
316 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAUSE);
317 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PRINT);
318 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SYSREQ);
319 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CLEAR);
320 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HOME);
321 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, END);
322 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LEFT);
323 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UP);
324 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, RIGHT);
325 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DOWN);
326 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAGEUP);
327 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PAGEDOWN);
328 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SHIFT);
329 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CTRL);
330 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, META);
331 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ALT);
332 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, CAPSLOCK);
333 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NUMLOCK);
334 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SCROLLLOCK);
335 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F1);
336 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F2);
337 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F3);
338 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F4);
339 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F5);
340 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F6);
341 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F7);
342 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F8);
343 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F9);
344 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F10);
345 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F11);
346 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F12);
347 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F13);
348 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F14);
349 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F15);
350 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F16);
351 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F17);
352 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F18);
353 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F19);
354 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F20);
355 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F21);
356 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F22);
357 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F23);
358 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F24);
359 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F25);
360 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F26);
361 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F27);
362 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F28);
363 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F29);
364 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F30);
365 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F31);
366 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F32);
367 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F33);
368 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F34);
369 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F35);
370 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_MULTIPLY);
371 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_DIVIDE);
372 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_SUBTRACT);
373 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_PERIOD);
374 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_ADD);
375 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_0);
376 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_1);
377 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_2);
378 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_3);
379 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_4);
380 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_5);
381 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_6);
382 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_7);
383 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_8);
384 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KP_9);
385 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MENU);
386 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HYPER);
387 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HELP);
388 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACK);
389 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, FORWARD);
390 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STOP);
391 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, REFRESH);
392 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEDOWN);
393 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEMUTE);
394 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, VOLUMEUP);
395 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIAPLAY);
396 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIASTOP);
397 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIAPREVIOUS);
398 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIANEXT);
399 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MEDIARECORD);
400 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, HOMEPAGE);
401 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, FAVORITES);
402 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SEARCH);
403 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, STANDBY);
404 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, OPENURL);
405 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHMAIL);
406 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHMEDIA);
407 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH0);
408 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH1);
409 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH2);
410 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH3);
411 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH4);
412 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH5);
413 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH6);
414 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH7);
415 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH8);
416 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCH9);
417 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHA);
418 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHB);
419 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHC);
420 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHD);
421 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHE);
422 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LAUNCHF);
423 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GLOBE);
424 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, KEYBOARD);
425 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_EISU);
426 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, JIS_KANA);
427 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UNKNOWN);
428 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SPACE);
429 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EXCLAM);
430 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUOTEDBL);
431 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, NUMBERSIGN);
432 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, DOLLAR);
433 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PERCENT);
434 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AMPERSAND);
435 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, APOSTROPHE);
436 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PARENLEFT);
437 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PARENRIGHT);
438 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASTERISK);
439 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PLUS);
440 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, COMMA);
441 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, MINUS);
442 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, PERIOD);
443 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SLASH);
444 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_0, KEY_0);
445 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_1, KEY_1);
446 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_2, KEY_2);
447 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_3, KEY_3);
448 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_4, KEY_4);
449 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_5, KEY_5);
450 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_6, KEY_6);
451 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_7, KEY_7);
452 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_8, KEY_8);
453 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(Key, KEY_9, KEY_9);
454 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, COLON);
455 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SEMICOLON);
456 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, LESS);
457 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, EQUAL);
458 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, GREATER);
459 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUESTION);
460 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, AT);
461 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, A);
462 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, B);
463 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, C);
464 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, D);
465 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, E);
466 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, F);
467 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, G);
468 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, H);
469 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, I);
470 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, J);
471 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, K);
472 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, L);
473 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, M);
474 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, N);
475 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, O);
476 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, P);
477 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Q);
478 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, R);
479 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, S);
480 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, T);
481 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, U);
482 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, V);
483 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, W);
484 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, X);
485 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Y);
486 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, Z);
487 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACKETLEFT);
488 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BACKSLASH);
489 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACKETRIGHT);
490 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASCIICIRCUM);
491 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, UNDERSCORE);
492 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, QUOTELEFT);
493 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACELEFT);
494 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BAR);
495 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, BRACERIGHT);
496 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, ASCIITILDE);
497 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, YEN);
498 BIND_CORE_ENUM_CLASS_CONSTANT(Key, KEY, SECTION);
499
500 BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(KeyModifierMask, KEY_CODE_MASK, CODE_MASK);
501 BIND_CORE_BITFIELD_CLASS_FLAG_CUSTOM(KeyModifierMask, KEY_MODIFIER_MASK, MODIFIER_MASK);
502 BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, CMD_OR_CTRL);
503 BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, SHIFT);
504 BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, ALT);
505 BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, META);
506 BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, CTRL);
507 BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, KPAD);
508 BIND_CORE_BITFIELD_CLASS_FLAG(KeyModifierMask, KEY_MASK, GROUP_SWITCH);
509
510 BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, NONE);
511 BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, LEFT);
512 BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, RIGHT);
513 BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, MIDDLE);
514 BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_UP);
515 BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_DOWN);
516 BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_LEFT);
517 BIND_CORE_ENUM_CLASS_CONSTANT(MouseButton, MOUSE_BUTTON, WHEEL_RIGHT);
518 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(MouseButton, MOUSE_BUTTON_XBUTTON1, MB_XBUTTON1);
519 BIND_CORE_ENUM_CLASS_CONSTANT_CUSTOM(MouseButton, MOUSE_BUTTON_XBUTTON2, MB_XBUTTON2);
520
521 BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, LEFT);
522 BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, RIGHT);
523 BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, MIDDLE);
524 BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, MB_XBUTTON1);
525 BIND_CORE_BITFIELD_CLASS_FLAG(MouseButtonMask, MOUSE_BUTTON_MASK, MB_XBUTTON2);
526
527 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, INVALID);
528 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, A);
529 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, B);
530 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, X);
531 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, Y);
532 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, BACK);
533 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, GUIDE);
534 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, START);
535 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, LEFT_STICK);
536 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, RIGHT_STICK);
537 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, LEFT_SHOULDER);
538 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, RIGHT_SHOULDER);
539 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_UP);
540 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_DOWN);
541 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_LEFT);
542 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, DPAD_RIGHT);
543 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MISC1);
544 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE1);
545 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE2);
546 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE3);
547 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, PADDLE4);
548 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, TOUCHPAD);
549 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, SDL_MAX);
550 BIND_CORE_ENUM_CLASS_CONSTANT(JoyButton, JOY_BUTTON, MAX);
551
552 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, INVALID);
553 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, LEFT_X);
554 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, LEFT_Y);
555 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, RIGHT_X);
556 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, RIGHT_Y);
557 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, TRIGGER_LEFT);
558 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, TRIGGER_RIGHT);
559 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, SDL_MAX);
560 BIND_CORE_ENUM_CLASS_CONSTANT(JoyAxis, JOY_AXIS, MAX);
561
562 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, NONE);
563 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, NOTE_OFF);
564 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, NOTE_ON);
565 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, AFTERTOUCH);
566 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, CONTROL_CHANGE);
567 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, PROGRAM_CHANGE);
568 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, CHANNEL_PRESSURE);
569 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, PITCH_BEND);
570 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, SYSTEM_EXCLUSIVE);
571 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, QUARTER_FRAME);
572 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, SONG_POSITION_POINTER);
573 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, SONG_SELECT);
574 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, TUNE_REQUEST);
575 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, TIMING_CLOCK);
576 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, START);
577 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, CONTINUE);
578 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, STOP);
579 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, ACTIVE_SENSING);
580 BIND_CORE_ENUM_CLASS_CONSTANT(MIDIMessage, MIDI_MESSAGE, SYSTEM_RESET);
581
582 // error list
583
584 BIND_CORE_ENUM_CONSTANT(OK); // (0)
585 BIND_CORE_ENUM_CONSTANT(FAILED);
586 BIND_CORE_ENUM_CONSTANT(ERR_UNAVAILABLE);
587 BIND_CORE_ENUM_CONSTANT(ERR_UNCONFIGURED);
588 BIND_CORE_ENUM_CONSTANT(ERR_UNAUTHORIZED);
589 BIND_CORE_ENUM_CONSTANT(ERR_PARAMETER_RANGE_ERROR); // (5)
590 BIND_CORE_ENUM_CONSTANT(ERR_OUT_OF_MEMORY);
591 BIND_CORE_ENUM_CONSTANT(ERR_FILE_NOT_FOUND);
592 BIND_CORE_ENUM_CONSTANT(ERR_FILE_BAD_DRIVE);
593 BIND_CORE_ENUM_CONSTANT(ERR_FILE_BAD_PATH);
594 BIND_CORE_ENUM_CONSTANT(ERR_FILE_NO_PERMISSION); // (10)
595 BIND_CORE_ENUM_CONSTANT(ERR_FILE_ALREADY_IN_USE);
596 BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_OPEN);
597 BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_WRITE);
598 BIND_CORE_ENUM_CONSTANT(ERR_FILE_CANT_READ);
599 BIND_CORE_ENUM_CONSTANT(ERR_FILE_UNRECOGNIZED); // (15)
600 BIND_CORE_ENUM_CONSTANT(ERR_FILE_CORRUPT);
601 BIND_CORE_ENUM_CONSTANT(ERR_FILE_MISSING_DEPENDENCIES);
602 BIND_CORE_ENUM_CONSTANT(ERR_FILE_EOF);
603 BIND_CORE_ENUM_CONSTANT(ERR_CANT_OPEN);
604 BIND_CORE_ENUM_CONSTANT(ERR_CANT_CREATE); // (20)
605 BIND_CORE_ENUM_CONSTANT(ERR_QUERY_FAILED);
606 BIND_CORE_ENUM_CONSTANT(ERR_ALREADY_IN_USE);
607 BIND_CORE_ENUM_CONSTANT(ERR_LOCKED);
608 BIND_CORE_ENUM_CONSTANT(ERR_TIMEOUT);
609 BIND_CORE_ENUM_CONSTANT(ERR_CANT_CONNECT); // (25)
610 BIND_CORE_ENUM_CONSTANT(ERR_CANT_RESOLVE);
611 BIND_CORE_ENUM_CONSTANT(ERR_CONNECTION_ERROR);
612 BIND_CORE_ENUM_CONSTANT(ERR_CANT_ACQUIRE_RESOURCE);
613 BIND_CORE_ENUM_CONSTANT(ERR_CANT_FORK);
614 BIND_CORE_ENUM_CONSTANT(ERR_INVALID_DATA); // (30)
615 BIND_CORE_ENUM_CONSTANT(ERR_INVALID_PARAMETER);
616 BIND_CORE_ENUM_CONSTANT(ERR_ALREADY_EXISTS);
617 BIND_CORE_ENUM_CONSTANT(ERR_DOES_NOT_EXIST);
618 BIND_CORE_ENUM_CONSTANT(ERR_DATABASE_CANT_READ);
619 BIND_CORE_ENUM_CONSTANT(ERR_DATABASE_CANT_WRITE); // (35)
620 BIND_CORE_ENUM_CONSTANT(ERR_COMPILATION_FAILED);
621 BIND_CORE_ENUM_CONSTANT(ERR_METHOD_NOT_FOUND);
622 BIND_CORE_ENUM_CONSTANT(ERR_LINK_FAILED);
623 BIND_CORE_ENUM_CONSTANT(ERR_SCRIPT_FAILED);
624 BIND_CORE_ENUM_CONSTANT(ERR_CYCLIC_LINK); // (40)
625 BIND_CORE_ENUM_CONSTANT(ERR_INVALID_DECLARATION);
626 BIND_CORE_ENUM_CONSTANT(ERR_DUPLICATE_SYMBOL);
627 BIND_CORE_ENUM_CONSTANT(ERR_PARSE_ERROR);
628 BIND_CORE_ENUM_CONSTANT(ERR_BUSY);
629 BIND_CORE_ENUM_CONSTANT(ERR_SKIP); // (45)
630 BIND_CORE_ENUM_CONSTANT(ERR_HELP);
631 BIND_CORE_ENUM_CONSTANT(ERR_BUG);
632 BIND_CORE_ENUM_CONSTANT(ERR_PRINTER_ON_FIRE);
633
634 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NONE);
635 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_RANGE);
636 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_ENUM);
637 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_ENUM_SUGGESTION);
638 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_EXP_EASING);
639 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LINK);
640 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_FLAGS);
641
642 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_RENDER);
643 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_PHYSICS);
644 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_2D_NAVIGATION);
645 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_RENDER);
646 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_PHYSICS);
647 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_3D_NAVIGATION);
648 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LAYERS_AVOIDANCE);
649
650 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_FILE);
651 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_DIR);
652 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_FILE);
653 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_DIR);
654 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_RESOURCE_TYPE);
655 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_MULTILINE_TEXT);
656 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_EXPRESSION);
657 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_PLACEHOLDER_TEXT);
658 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_COLOR_NO_ALPHA);
659 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_OBJECT_ID);
660 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_TYPE_STRING);
661
662 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NODE_PATH_TO_EDITED_NODE);
663 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_OBJECT_TOO_BIG);
664 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NODE_PATH_VALID_TYPES);
665 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_SAVE_FILE);
666 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_GLOBAL_SAVE_FILE);
667 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_INT_IS_OBJECTID);
668 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_INT_IS_POINTER);
669 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_ARRAY_TYPE);
670 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LOCALE_ID);
671 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LOCALIZABLE_STRING);
672 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NODE_TYPE);
673 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_HIDE_QUATERNION_EDIT);
674 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_PASSWORD);
675 BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_MAX);
676
677 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NONE);
678 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_STORAGE);
679 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_EDITOR);
680 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_INTERNAL);
681
682 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CHECKABLE);
683 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CHECKED);
684 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_GROUP);
685 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CATEGORY);
686 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_SUBGROUP);
687 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CLASS_IS_BITFIELD);
688 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NO_INSTANCE_STATE);
689 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_RESTART_IF_CHANGED);
690 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_SCRIPT_VARIABLE);
691
692 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_STORE_IF_NULL);
693 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED);
694 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_SCRIPT_DEFAULT_VALUE);
695 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_CLASS_IS_ENUM);
696 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NIL_IS_VARIANT);
697 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_ARRAY);
698 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_ALWAYS_DUPLICATE);
699 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NEVER_DUPLICATE);
700 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_HIGH_END_GFX);
701 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NODE_PATH_FROM_SCENE_ROOT);
702 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_RESOURCE_NOT_PERSISTENT);
703 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_KEYING_INCREMENTS);
704 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_DEFERRED_SET_RESOURCE);
705 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_EDITOR_INSTANTIATE_OBJECT);
706 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_EDITOR_BASIC_SETTING);
707 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_READ_ONLY);
708 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_SECRET);
709
710 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_DEFAULT);
711 BIND_CORE_BITFIELD_FLAG(PROPERTY_USAGE_NO_EDITOR);
712
713 BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_NORMAL);
714 BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_EDITOR);
715 BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_CONST);
716 BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_VIRTUAL);
717 BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_VARARG);
718 BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_STATIC);
719 BIND_CORE_BITFIELD_FLAG(METHOD_FLAG_OBJECT_CORE);
720 BIND_CORE_BITFIELD_FLAG(METHOD_FLAGS_DEFAULT);
721
722 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NIL", Variant::NIL);
723 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BOOL", Variant::BOOL);
724 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_INT", Variant::INT);
725 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_FLOAT", Variant::FLOAT);
726 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING", Variant::STRING);
727 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2", Variant::VECTOR2);
728 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR2I", Variant::VECTOR2I);
729 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RECT2", Variant::RECT2);
730 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RECT2I", Variant::RECT2I);
731 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3", Variant::VECTOR3);
732 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR3I", Variant::VECTOR3I);
733 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM2D", Variant::TRANSFORM2D);
734 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR4", Variant::VECTOR4);
735 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_VECTOR4I", Variant::VECTOR4I);
736 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PLANE", Variant::PLANE);
737 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_QUATERNION", Variant::QUATERNION);
738 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_AABB", Variant::AABB);
739 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_BASIS", Variant::BASIS);
740 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_TRANSFORM3D", Variant::TRANSFORM3D);
741 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PROJECTION", Variant::PROJECTION);
742 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_COLOR", Variant::COLOR);
743 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_STRING_NAME", Variant::STRING_NAME);
744 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_NODE_PATH", Variant::NODE_PATH);
745 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_RID", Variant::RID);
746 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_OBJECT", Variant::OBJECT);
747 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_CALLABLE", Variant::CALLABLE);
748 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_SIGNAL", Variant::SIGNAL);
749 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_DICTIONARY", Variant::DICTIONARY);
750 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_ARRAY", Variant::ARRAY);
751 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_BYTE_ARRAY", Variant::PACKED_BYTE_ARRAY);
752 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_INT32_ARRAY", Variant::PACKED_INT32_ARRAY);
753 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_INT64_ARRAY", Variant::PACKED_INT64_ARRAY);
754 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_FLOAT32_ARRAY", Variant::PACKED_FLOAT32_ARRAY);
755 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_FLOAT64_ARRAY", Variant::PACKED_FLOAT64_ARRAY);
756 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_STRING_ARRAY", Variant::PACKED_STRING_ARRAY);
757 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_VECTOR2_ARRAY", Variant::PACKED_VECTOR2_ARRAY);
758 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_VECTOR3_ARRAY", Variant::PACKED_VECTOR3_ARRAY);
759 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_PACKED_COLOR_ARRAY", Variant::PACKED_COLOR_ARRAY);
760 BIND_CORE_ENUM_CONSTANT_CUSTOM("TYPE_MAX", Variant::VARIANT_MAX);
761
762 //comparison
763 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_EQUAL", Variant::OP_EQUAL);
764 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NOT_EQUAL", Variant::OP_NOT_EQUAL);
765 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_LESS", Variant::OP_LESS);
766 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_LESS_EQUAL", Variant::OP_LESS_EQUAL);
767 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_GREATER", Variant::OP_GREATER);
768 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_GREATER_EQUAL", Variant::OP_GREATER_EQUAL);
769 //mathematic
770 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_ADD", Variant::OP_ADD);
771 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SUBTRACT", Variant::OP_SUBTRACT);
772 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MULTIPLY", Variant::OP_MULTIPLY);
773 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_DIVIDE", Variant::OP_DIVIDE);
774 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NEGATE", Variant::OP_NEGATE);
775 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_POSITIVE", Variant::OP_POSITIVE);
776 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MODULE", Variant::OP_MODULE);
777 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_POWER", Variant::OP_POWER);
778 //bitwise
779 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SHIFT_LEFT", Variant::OP_SHIFT_LEFT);
780 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_SHIFT_RIGHT", Variant::OP_SHIFT_RIGHT);
781 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_AND", Variant::OP_BIT_AND);
782 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_OR", Variant::OP_BIT_OR);
783 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_XOR", Variant::OP_BIT_XOR);
784 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_BIT_NEGATE", Variant::OP_BIT_NEGATE);
785 //logic
786 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_AND", Variant::OP_AND);
787 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_OR", Variant::OP_OR);
788 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_XOR", Variant::OP_XOR);
789 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_NOT", Variant::OP_NOT);
790 //containment
791 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_IN", Variant::OP_IN);
792 BIND_CORE_ENUM_CONSTANT_CUSTOM("OP_MAX", Variant::OP_MAX);
793}
794
795void unregister_global_constants() {
796 _global_constants.clear();
797}
798
799int CoreConstants::get_global_constant_count() {
800 return _global_constants.size();
801}
802
803StringName CoreConstants::get_global_constant_enum(int p_idx) {
804 return _global_constants[p_idx].enum_name;
805}
806
807#ifdef DEBUG_METHODS_ENABLED
808bool CoreConstants::is_global_constant_bitfield(int p_idx) {
809 return _global_constants[p_idx].is_bitfield;
810}
811
812bool CoreConstants::get_ignore_value_in_docs(int p_idx) {
813 return _global_constants[p_idx].ignore_value_in_docs;
814}
815#else
816bool CoreConstants::is_global_constant_bitfield(int p_idx) {
817 return false;
818}
819
820bool CoreConstants::get_ignore_value_in_docs(int p_idx) {
821 return false;
822}
823#endif
824
825const char *CoreConstants::get_global_constant_name(int p_idx) {
826 return _global_constants[p_idx].name;
827}
828
829int64_t CoreConstants::get_global_constant_value(int p_idx) {
830 return _global_constants[p_idx].value;
831}
832
833bool CoreConstants::is_global_constant(const StringName &p_name) {
834 return _global_constants_map.has(p_name);
835}
836
837int CoreConstants::get_global_constant_index(const StringName &p_name) {
838 ERR_FAIL_COND_V_MSG(!_global_constants_map.has(p_name), -1, "Trying to get index of non-existing constant.");
839 return _global_constants_map[p_name];
840}
841
842bool CoreConstants::is_global_enum(const StringName &p_enum) {
843 return _global_enums.has(p_enum);
844}
845
846void CoreConstants::get_enum_values(StringName p_enum, HashMap<StringName, int64_t> *p_values) {
847 ERR_FAIL_NULL_MSG(p_values, "Trying to get enum values with null map.");
848 ERR_FAIL_COND_MSG(!_global_enums.has(p_enum), "Trying to get values of non-existing enum.");
849 for (const _CoreConstant &constant : _global_enums[p_enum]) {
850 (*p_values)[constant.name] = constant.value;
851 }
852}
853