Colobot
event.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2016, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsitec.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
25 #pragma once
26 
27 #include "common/key.h"
28 #include "common/make_unique.h"
29 
30 #include "common/thread/sdl_mutex_wrapper.h"
31 
32 #include "math/point.h"
33 #include "math/vector.h"
34 
35 #include <memory>
36 
42 {
43 
44 // TODO: document the meaning of each value
45 
48 
49  // System events (originating in CApplication)
50 
53 
56 
69 
76 
83 
88 
90  EVENT_SYS_MAX,
91 
92 
93  /* Events sent/received in game and user interface */
94 
96  EVENT_QUIT = 20,
97  EVENT_UPDINTERFACE = 21,
102  EVENT_WIN = 30,
103  EVENT_LOST = 31,
104 
107 
108  EVENT_BUTTON_OK = 40,
109  EVENT_BUTTON_CANCEL = 41,
110  EVENT_BUTTON_NEXT = 42,
111  EVENT_BUTTON_PREV = 43,
112 
113  EVENT_BUTTON0 = 50,
114  EVENT_BUTTON1 = 51,
115  EVENT_BUTTON2 = 52,
116  EVENT_BUTTON3 = 53,
117  EVENT_BUTTON4 = 54,
118  EVENT_BUTTON5 = 55,
119  EVENT_BUTTON6 = 56,
120  EVENT_BUTTON7 = 57,
121  EVENT_BUTTON8 = 58,
122  EVENT_BUTTON9 = 59,
123  EVENT_BUTTON10 = 60,
124  EVENT_BUTTON11 = 61,
125  EVENT_BUTTON12 = 62,
126  EVENT_BUTTON13 = 63,
127  EVENT_BUTTON14 = 64,
128  EVENT_BUTTON15 = 65,
129  EVENT_BUTTON16 = 66,
130  EVENT_BUTTON17 = 67,
131  EVENT_BUTTON18 = 68,
132  EVENT_BUTTON19 = 69,
133 
134  EVENT_EDIT0 = 70,
135  EVENT_EDIT1 = 71,
136  EVENT_EDIT2 = 72,
137  EVENT_EDIT3 = 73,
138  EVENT_EDIT4 = 74,
139  EVENT_EDIT5 = 75,
140  EVENT_EDIT6 = 76,
141  EVENT_EDIT7 = 77,
142  EVENT_EDIT8 = 78,
143  EVENT_EDIT9 = 79,
144 
155 
156  EVENT_LABEL0 = 90,
157  EVENT_LABEL1 = 91,
158  EVENT_LABEL2 = 92,
159  EVENT_LABEL3 = 93,
160  EVENT_LABEL4 = 94,
161  EVENT_LABEL5 = 95,
162  EVENT_LABEL6 = 96,
163  EVENT_LABEL7 = 97,
164  EVENT_LABEL8 = 98,
165  EVENT_LABEL9 = 99,
166  EVENT_LABEL10 = 100,
167  EVENT_LABEL11 = 101,
168  EVENT_LABEL12 = 102,
169  EVENT_LABEL13 = 103,
170  EVENT_LABEL14 = 104,
171  EVENT_LABEL15 = 105,
172  EVENT_LABEL16 = 106,
173  EVENT_LABEL17 = 107,
174  EVENT_LABEL18 = 108,
175  EVENT_LABEL19 = 109,
176 
177  EVENT_LIST0 = 110,
178  EVENT_LIST1 = 111,
179  EVENT_LIST2 = 112, // list of resolutions
180  EVENT_LIST3 = 113,
181  EVENT_LIST4 = 114,
182  EVENT_LIST5 = 115,
183  EVENT_LIST6 = 116,
184  EVENT_LIST7 = 117,
185  EVENT_LIST8 = 118,
186  EVENT_LIST9 = 119,
187 
188  EVENT_LOADING = 120,
189 
190  EVENT_TOOLTIP = 200,
191 
192  EVENT_DIALOG_OK = 300,
193  EVENT_DIALOG_CANCEL = 301,
194  EVENT_DIALOG_LABEL = 302,
195  EVENT_DIALOG_LABEL1 = 303,
196  EVENT_DIALOG_LABEL2 = 304,
197  EVENT_DIALOG_LABEL3 = 305,
198  EVENT_DIALOG_LIST = 306,
199  EVENT_DIALOG_EDIT = 307,
200  EVENT_DIALOG_CHECK1 = 308,
201  EVENT_DIALOG_CHECK2 = 309,
202 
203  EVENT_INTERFACE_TRAINER = 400,
204  EVENT_INTERFACE_DEFI = 401,
205  EVENT_INTERFACE_MISSION = 402,
206  EVENT_INTERFACE_FREE = 403,
207  EVENT_INTERFACE_CODE_BATTLES = 404,
208  EVENT_INTERFACE_NAME = 405,
209  EVENT_INTERFACE_SETUP = 406,
210  EVENT_INTERFACE_QUIT = 407,
211  EVENT_INTERFACE_BACK = 408,
212  EVENT_INTERFACE_AGAIN = 409,
213  EVENT_INTERFACE_WRITE = 410,
214  EVENT_INTERFACE_READ = 411,
215  EVENT_INTERFACE_ABORT = 412,
216  EVENT_INTERFACE_USER = 413,
217  EVENT_INTERFACE_SATCOM = 414,
218 
219  EVENT_INTERFACE_CHAP = 420,
220  EVENT_INTERFACE_LIST = 421,
221  EVENT_INTERFACE_RESUME = 422,
222  EVENT_INTERFACE_PLAY = 423,
223 
224  EVENT_INTERFACE_SETUPd = 430,
225  EVENT_INTERFACE_SETUPg = 431,
226  EVENT_INTERFACE_SETUPp = 432,
227  EVENT_INTERFACE_SETUPc = 433,
228  EVENT_INTERFACE_SETUPs = 434,
229 
230  EVENT_INTERFACE_DEVICE = 440,
231  EVENT_INTERFACE_RESOL = 441,
232  EVENT_INTERFACE_FULL = 442,
233  EVENT_INTERFACE_APPLY = 443,
234 
235  EVENT_INTERFACE_SHADOW_SPOTS = 451,
236  EVENT_INTERFACE_DIRTY = 452,
237  EVENT_INTERFACE_LIGHT = 457,
238  EVENT_INTERFACE_PARTI = 458,
239  EVENT_INTERFACE_CLIP = 459,
240  EVENT_INTERFACE_PAUSE_BLUR = 460,
241  EVENT_INTERFACE_RAIN = 462,
242  EVENT_INTERFACE_GLINT = 463,
243  EVENT_INTERFACE_TOOLTIP = 464,
244  EVENT_INTERFACE_MOVIES = 465,
245  EVENT_INTERFACE_SCROLL = 467,
246  EVENT_INTERFACE_INVERTX = 468,
247  EVENT_INTERFACE_INVERTY = 469,
248  EVENT_INTERFACE_EFFECT = 470,
249  EVENT_INTERFACE_BGPAUSE = 471,
250  EVENT_INTERFACE_FOG = 474,
251  EVENT_INTERFACE_EDITMODE= 476,
252  EVENT_INTERFACE_EDITVALUE= 477,
253  EVENT_INTERFACE_SOLUCE4 = 478,
254  EVENT_INTERFACE_BLOOD = 479,
255  EVENT_INTERFACE_AUTOSAVE_ENABLE = 780,
256  EVENT_INTERFACE_AUTOSAVE_INTERVAL = 781,
257  EVENT_INTERFACE_AUTOSAVE_SLOTS = 782,
258  EVENT_INTERFACE_TEXTURE_FILTER = 783,
259  EVENT_INTERFACE_TEXTURE_MIPMAP = 784,
260  EVENT_INTERFACE_TEXTURE_ANISOTROPY = 785,
261  EVENT_INTERFACE_MSAA = 786,
262  EVENT_INTERFACE_SHADOW_MAPPING = 787,
263  EVENT_INTERFACE_SHADOW_MAPPING_QUALITY = 788,
264  EVENT_INTERFACE_SHADOW_MAPPING_BUFFER = 789,
265  EVENT_INTERFACE_LANGUAGE = 790,
266 
267  EVENT_INTERFACE_KINFO1 = 500,
268  EVENT_INTERFACE_KINFO2 = 501,
269  EVENT_INTERFACE_KGROUP = 502,
270  EVENT_INTERFACE_KSCROLL = 503,
271  EVENT_INTERFACE_KDEF = 504,
272  // Reserved space for keybindings
273  // This is not the nicest solution, but it'll have to work like that until we move to CEGUI
274  EVENT_INTERFACE_KEY = 505,
275  EVENT_INTERFACE_KEY_END = 539,
276 
277  EVENT_INTERFACE_MIN = 540,
278  EVENT_INTERFACE_NORM = 541,
279  EVENT_INTERFACE_MAX = 542,
280 
281  EVENT_INTERFACE_VOLSOUND= 550,
282  EVENT_INTERFACE_VOLMUSIC= 551,
283  EVENT_INTERFACE_SILENT = 552,
284  EVENT_INTERFACE_NOISY = 553,
285 
286  EVENT_INTERFACE_JOYSTICK= 560,
287  EVENT_INTERFACE_SOLUCE = 561,
288  EVENT_INTERFACE_JOYSTICK_DEADZONE = 562,
289  EVENT_INTERFACE_JOYSTICK_X = 563,
290  EVENT_INTERFACE_JOYSTICK_Y = 564,
291  EVENT_INTERFACE_JOYSTICK_Z = 565,
292  EVENT_INTERFACE_JOYSTICK_CAM_X = 566,
293  EVENT_INTERFACE_JOYSTICK_CAM_Y = 567,
294  EVENT_INTERFACE_JOYSTICK_CAM_Z = 568,
295  EVENT_INTERFACE_JOYSTICK_X_INVERT = 569,
296  EVENT_INTERFACE_JOYSTICK_Y_INVERT = 570,
297  EVENT_INTERFACE_JOYSTICK_Z_INVERT = 571,
298  EVENT_INTERFACE_JOYSTICK_CAM_X_INVERT = 572,
299  EVENT_INTERFACE_JOYSTICK_CAM_Y_INVERT = 573,
300  EVENT_INTERFACE_JOYSTICK_CAM_Z_INVERT = 574,
301 
302  EVENT_INTERFACE_GLINTl = 590,
303  EVENT_INTERFACE_GLINTr = 591,
304  EVENT_INTERFACE_GLINTu = 592,
305  EVENT_INTERFACE_GLINTb = 593,
306 
307  EVENT_INTERFACE_NEDIT = 595,
308  EVENT_INTERFACE_NLIST = 596,
309  EVENT_INTERFACE_NOK = 597,
310  EVENT_INTERFACE_NDELETE = 598,
311  EVENT_INTERFACE_NLABEL = 599,
312 
313  EVENT_INTERFACE_IOWRITE = 600,
314  EVENT_INTERFACE_IOREAD = 601,
315  EVENT_INTERFACE_IOLIST = 602,
316  EVENT_INTERFACE_IONAME = 603,
317  EVENT_INTERFACE_IOLABEL = 604,
318  EVENT_INTERFACE_IOIMAGE = 605,
319  EVENT_INTERFACE_IODELETE= 606,
320 
321  EVENT_INTERFACE_PERSO = 620,
322  EVENT_INTERFACE_POK = 621,
323  EVENT_INTERFACE_PCANCEL = 622,
324  EVENT_INTERFACE_PDEF = 623,
325  EVENT_INTERFACE_PHEAD = 624,
326  EVENT_INTERFACE_PBODY = 625,
327  EVENT_INTERFACE_PLROT = 626,
328  EVENT_INTERFACE_PRROT = 627,
329  EVENT_INTERFACE_PC0a = 640,
330  EVENT_INTERFACE_PC1a = 641,
331  EVENT_INTERFACE_PC2a = 642,
332  EVENT_INTERFACE_PC3a = 643,
333  EVENT_INTERFACE_PC4a = 644,
334  EVENT_INTERFACE_PC5a = 645,
335  EVENT_INTERFACE_PC6a = 646,
336  EVENT_INTERFACE_PC7a = 647,
337  EVENT_INTERFACE_PC8a = 648,
338  EVENT_INTERFACE_PC9a = 649,
339  EVENT_INTERFACE_PCRa = 650,
340  EVENT_INTERFACE_PCGa = 651,
341  EVENT_INTERFACE_PCBa = 652,
342  EVENT_INTERFACE_PC0b = 660,
343  EVENT_INTERFACE_PC1b = 661,
344  EVENT_INTERFACE_PC2b = 662,
345  EVENT_INTERFACE_PC3b = 663,
346  EVENT_INTERFACE_PC4b = 664,
347  EVENT_INTERFACE_PC5b = 665,
348  EVENT_INTERFACE_PC6b = 666,
349  EVENT_INTERFACE_PC7b = 667,
350  EVENT_INTERFACE_PC8b = 668,
351  EVENT_INTERFACE_PC9b = 669,
352  EVENT_INTERFACE_PCRb = 670,
353  EVENT_INTERFACE_PCGb = 671,
354  EVENT_INTERFACE_PCBb = 672,
355  EVENT_INTERFACE_PFACE1 = 680,
356  EVENT_INTERFACE_PFACE2 = 681,
357  EVENT_INTERFACE_PFACE3 = 682,
358  EVENT_INTERFACE_PFACE4 = 683,
359  EVENT_INTERFACE_PGLASS0 = 690,
360  EVENT_INTERFACE_PGLASS1 = 691,
361  EVENT_INTERFACE_PGLASS2 = 692,
362  EVENT_INTERFACE_PGLASS3 = 693,
363  EVENT_INTERFACE_PGLASS4 = 694,
364  EVENT_INTERFACE_PGLASS5 = 695,
365  EVENT_INTERFACE_PGLASS6 = 696,
366  EVENT_INTERFACE_PGLASS7 = 697,
367  EVENT_INTERFACE_PGLASS8 = 698,
368  EVENT_INTERFACE_PGLASS9 = 699,
369 
370  EVENT_DT_GROUP0 = 700,
371  EVENT_DT_GROUP1 = 701,
372  EVENT_DT_GROUP2 = 702,
373  EVENT_DT_GROUP3 = 703,
374  EVENT_DT_GROUP4 = 704,
375  EVENT_DT_LABEL0 = 710,
376  EVENT_DT_LABEL1 = 711,
377  EVENT_DT_LABEL2 = 712,
378  EVENT_DT_LABEL3 = 713,
379  EVENT_DT_LABEL4 = 714,
380  EVENT_DT_VISIT0 = 720,
381  EVENT_DT_VISIT1 = 721,
382  EVENT_DT_VISIT2 = 722,
383  EVENT_DT_VISIT3 = 723,
384  EVENT_DT_VISIT4 = 724,
385  EVENT_DT_END = 725,
386 
387  EVENT_CMD = 800,
388  EVENT_SPEED = 801,
389 
390  EVENT_DBG_STATS = 850,
391  EVENT_DBG_SPAWN_OBJ = 851,
392  EVENT_DBG_TELEPORT = 852,
393  EVENT_DBG_LIGHTNING = 853,
394  EVENT_DBG_RESOURCES = 854,
395  EVENT_DBG_GOTO = 855,
396  EVENT_DBG_CRASHSPHERES = 856,
397  EVENT_DBG_LIGHTS = 857,
398  EVENT_DBG_LIGHTS_DUMP = 858,
399 
400  EVENT_SPAWN_CANCEL = 860,
401  EVENT_SPAWN_ME = 861,
402  EVENT_SPAWN_WHEELEDGRABBER = 862,
403  EVENT_SPAWN_WHEELEDSHOOTER = 863,
404  EVENT_SPAWN_PHAZERSHOOTER = 864,
405  EVENT_SPAWN_BOTFACTORY = 865,
406  EVENT_SPAWN_CONVERTER = 866,
407  EVENT_SPAWN_DERRICK = 867,
408  EVENT_SPAWN_POWERSTATION= 868,
409  EVENT_SPAWN_TITANIUM = 869,
410  EVENT_SPAWN_TITANIUMORE = 870,
411  EVENT_SPAWN_URANIUMORE = 871,
412  EVENT_SPAWN_POWERCELL = 872,
413  EVENT_SPAWN_NUCLEARCELL = 873,
414 
415  EVENT_HYPER_PREV = 900,
416  EVENT_HYPER_NEXT = 901,
417  EVENT_HYPER_HOME = 902,
418  EVENT_HYPER_COPY = 903,
419  EVENT_HYPER_SIZE1 = 904,
420  EVENT_HYPER_SIZE2 = 905,
421  EVENT_HYPER_SIZE3 = 906,
422  EVENT_HYPER_SIZE4 = 907,
423  EVENT_HYPER_SIZE5 = 908,
424 
425  EVENT_SATCOM_HUSTON = 920,
426  EVENT_SATCOM_SAT = 921,
427  EVENT_SATCOM_LOADING = 922,
428  EVENT_SATCOM_OBJECT = 923,
429  EVENT_SATCOM_PROG = 924,
430  EVENT_SATCOM_SOLUCE = 925,
431 
432  EVENT_OBJECT_DESELECT = 1000,
433  EVENT_OBJECT_LEFT = 1001,
434  EVENT_OBJECT_RIGHT = 1002,
435  EVENT_OBJECT_UP = 1003,
436  EVENT_OBJECT_DOWN = 1004,
437  EVENT_OBJECT_GASUP = 1005,
438  EVENT_OBJECT_GASDOWN = 1006,
439  EVENT_OBJECT_HTAKE = 1020,
440  EVENT_OBJECT_MTAKE = 1021,
441  EVENT_OBJECT_MFRONT = 1022,
442  EVENT_OBJECT_MBACK = 1023,
443  EVENT_OBJECT_MPOWER = 1024,
444  EVENT_OBJECT_BHELP = 1040,
445  EVENT_OBJECT_BTAKEOFF = 1041,
446  EVENT_OBJECT_BDESTROY = 1042,
447  EVENT_OBJECT_BDERRICK = 1050,
448  EVENT_OBJECT_BSTATION = 1051,
449  EVENT_OBJECT_BFACTORY = 1052,
450  EVENT_OBJECT_BCONVERT = 1053,
451  EVENT_OBJECT_BTOWER = 1054,
452  EVENT_OBJECT_BREPAIR = 1055,
453  EVENT_OBJECT_BRESEARCH = 1056,
454  EVENT_OBJECT_BRADAR = 1057,
455  EVENT_OBJECT_BENERGY = 1058,
456  EVENT_OBJECT_BLABO = 1059,
457  EVENT_OBJECT_BNUCLEAR = 1060,
458  EVENT_OBJECT_BPARA = 1061,
459  EVENT_OBJECT_BINFO = 1062,
460  EVENT_OBJECT_BDESTROYER = 1063,
461  EVENT_OBJECT_GFLAT = 1070,
462  EVENT_OBJECT_FCREATE = 1071,
463  EVENT_OBJECT_FDELETE = 1072,
464  EVENT_OBJECT_FCOLORb = 1073,
465  EVENT_OBJECT_FCOLORr = 1074,
466  EVENT_OBJECT_FCOLORg = 1075,
467  EVENT_OBJECT_FCOLORy = 1076,
468  EVENT_OBJECT_FCOLORv = 1077,
469  EVENT_OBJECT_FACTORYwa = 1080,
470  EVENT_OBJECT_FACTORYta = 1081,
471  EVENT_OBJECT_FACTORYfa = 1082,
472  EVENT_OBJECT_FACTORYia = 1083,
473  EVENT_OBJECT_FACTORYwc = 1084,
474  EVENT_OBJECT_FACTORYtc = 1085,
475  EVENT_OBJECT_FACTORYfc = 1086,
476  EVENT_OBJECT_FACTORYic = 1087,
477  EVENT_OBJECT_FACTORYwi = 1088,
478  EVENT_OBJECT_FACTORYti = 1089,
479  EVENT_OBJECT_FACTORYfi = 1090,
480  EVENT_OBJECT_FACTORYii = 1091,
481  EVENT_OBJECT_FACTORYws = 1092,
482  EVENT_OBJECT_FACTORYts = 1093,
483  EVENT_OBJECT_FACTORYfs = 1094,
484  EVENT_OBJECT_FACTORYis = 1095,
485  EVENT_OBJECT_FACTORYrt = 1096,
486  EVENT_OBJECT_FACTORYrc = 1097,
487  EVENT_OBJECT_FACTORYrr = 1098,
488  EVENT_OBJECT_FACTORYrs = 1099,
489  EVENT_OBJECT_FACTORYsa = 1100,
490  EVENT_OBJECT_SEARCH = 1200,
491  EVENT_OBJECT_TERRAFORM = 1201,
492  EVENT_OBJECT_FIRE = 1202,
493  EVENT_OBJECT_FIREANT = 1203,
494  EVENT_OBJECT_SPIDEREXPLO= 1204,
495  EVENT_OBJECT_RECOVER = 1220,
496  EVENT_OBJECT_BEGSHIELD = 1221,
497  EVENT_OBJECT_ENDSHIELD = 1222,
498  EVENT_OBJECT_RTANK = 1223,
499  EVENT_OBJECT_RFLY = 1224,
500  EVENT_OBJECT_RTHUMP = 1225,
501  EVENT_OBJECT_RCANON = 1226,
502  EVENT_OBJECT_RTOWER = 1227,
503  EVENT_OBJECT_RPHAZER = 1228,
504  EVENT_OBJECT_RSHIELD = 1229,
505  EVENT_OBJECT_RATOMIC = 1230,
506  EVENT_OBJECT_RiPAW = 1231,
507  EVENT_OBJECT_RiGUN = 1232,
508  EVENT_OBJECT_RESET = 1233,
509  EVENT_OBJECT_DIMSHIELD = 1234,
510  EVENT_OBJECT_TARGET = 1235,
511  EVENT_OBJECT_DELSEARCH = 1236, // delete mark on ground
512  EVENT_OBJECT_PROGLIST = 1310,
513  EVENT_OBJECT_PROGRUN = 1311,
514  EVENT_OBJECT_PROGEDIT = 1312,
515  EVENT_OBJECT_PROGSTART = 1313,
516  EVENT_OBJECT_PROGSTOP = 1314,
517  EVENT_OBJECT_PROGADD = 1315,
518  EVENT_OBJECT_PROGREMOVE = 1316,
519  EVENT_OBJECT_PROGCLONE = 1317,
520  EVENT_OBJECT_PROGMOVEUP = 1318,
521  EVENT_OBJECT_PROGMOVEDOWN = 1319,
522  EVENT_OBJECT_INFOOK = 1340,
523  EVENT_OBJECT_DELETE = 1350,
524  EVENT_OBJECT_GENERGY = 1360,
525  EVENT_OBJECT_GSHIELD = 1361,
526  EVENT_OBJECT_GRANGE = 1362,
527  EVENT_OBJECT_MAP = 1364,
528  EVENT_OBJECT_MAPZOOM = 1365,
529  EVENT_OBJECT_GPROGRESS = 1366,
530  EVENT_OBJECT_GRADAR = 1367,
531  EVENT_OBJECT_GINFO = 1368,
532  EVENT_OBJECT_TYPE = 1369,
533  EVENT_OBJECT_CROSSHAIR = 1370,
534  EVENT_OBJECT_CORNERul = 1371,
535  EVENT_OBJECT_CORNERur = 1372,
536  EVENT_OBJECT_CORNERdl = 1373,
537  EVENT_OBJECT_CORNERdr = 1374,
538  EVENT_OBJECT_MAPi = 1375,
539  EVENT_OBJECT_MAPg = 1376,
540  EVENT_OBJECT_CAMERA = 1400,
541  EVENT_OBJECT_HELP = 1401,
542  EVENT_OBJECT_SOLUCE = 1402,
543  EVENT_OBJECT_CAMERAleft = 1403,
544  EVENT_OBJECT_CAMERAright= 1404,
545  EVENT_OBJECT_CAMERAnear = 1405,
546  EVENT_OBJECT_CAMERAaway = 1406,
547  EVENT_OBJECT_SHORTCUT_MODE = 1500,
548  EVENT_OBJECT_SHORTCUT = 1501,
549  EVENT_OBJECT_SHORTCUT_MAX = 1549,
550  EVENT_OBJECT_MOVIELOCK = 1550,
551  EVENT_OBJECT_EDITLOCK = 1551,
552  EVENT_OBJECT_SAVING = 1552,
553  EVENT_OBJECT_LIMIT = 1560,
554 
555  EVENT_OBJECT_PEN0 = 1570,
556  EVENT_OBJECT_PEN1 = 1571,
557  EVENT_OBJECT_PEN2 = 1572,
558  EVENT_OBJECT_PEN3 = 1573,
559  EVENT_OBJECT_PEN4 = 1574,
560  EVENT_OBJECT_PEN5 = 1575,
561  EVENT_OBJECT_PEN6 = 1576,
562  EVENT_OBJECT_PEN7 = 1577,
563  EVENT_OBJECT_PEN8 = 1578,
564  EVENT_OBJECT_REC = 1580,
565  EVENT_OBJECT_STOP = 1581,
566 
567  EVENT_STUDIO_OK = 2000,
568  EVENT_STUDIO_CANCEL = 2001,
569  EVENT_STUDIO_EDIT = 2002,
570  EVENT_STUDIO_LIST = 2003,
571  EVENT_STUDIO_CLONE = 2004,
572  EVENT_STUDIO_NEW = 2010,
573  EVENT_STUDIO_OPEN = 2011,
574  EVENT_STUDIO_SAVE = 2012,
575  EVENT_STUDIO_UNDO = 2013,
576  EVENT_STUDIO_CUT = 2014,
577  EVENT_STUDIO_COPY = 2015,
578  EVENT_STUDIO_PASTE = 2016,
579  EVENT_STUDIO_SIZE = 2017,
580  EVENT_STUDIO_TOOL = 2018,
581  EVENT_STUDIO_HELP = 2019,
582  EVENT_STUDIO_COMPILE = 2050,
583  EVENT_STUDIO_RUN = 2051,
584  EVENT_STUDIO_REALTIME = 2052,
585  EVENT_STUDIO_STEP = 2053,
586 
588 
591 
594 
595  EVENT_USER = 10000,
596  EVENT_FORCE_LONG = 0x7fffffff
597 };
598 
603 struct EventData
604 {
605  virtual ~EventData()
606  {}
607 
608  virtual std::unique_ptr<EventData> Clone() const = 0;
609 };
610 
615 struct KeyEventData : public EventData
616 {
617  std::unique_ptr<EventData> Clone() const override
618  {
619  return MakeUnique<KeyEventData>(*this);
620  }
621 
623  bool virt = false;
625  unsigned int key = 0;
627  InputSlot slot = INPUT_SLOT_MAX;
628 };
629 
634  struct TextInputData : public EventData
635  {
636  std::unique_ptr<EventData> Clone() const override
637  {
638  return MakeUnique<TextInputData>(*this);
639  }
640 
642  std::string text = "";
643  };
644 
652 {
653  MOUSE_BUTTON_LEFT = (1<<1),
654  MOUSE_BUTTON_MIDDLE = (1<<2),
655  MOUSE_BUTTON_RIGHT = (1<<3),
658 };
659 
665 {
666  std::unique_ptr<EventData> Clone() const override
667  {
668  return MakeUnique<MouseButtonEventData>(*this);
669  }
670 
672  MouseButton button = MOUSE_BUTTON_LEFT;
673 };
674 
680 {
681  std::unique_ptr<EventData> Clone() const override
682  {
683  return MakeUnique<MouseWheelEventData>(*this);
684  }
685 
687  signed int y = 0;
689  signed int x = 0;
690 };
691 
697 {
698  std::unique_ptr<EventData> Clone() const override
699  {
700  return MakeUnique<JoyAxisEventData>(*this);
701  }
702 
704  unsigned char axis = 0;
706  int value = 0;
707 };
708 
714 {
715  std::unique_ptr<EventData> Clone() const override
716  {
717  return MakeUnique<JoyButtonEventData>(*this);
718  }
719 
721  unsigned char button = 0;
722 };
723 
735 struct Event
736 {
737  explicit Event(EventType type = EVENT_NULL)
738  : type(type),
739  rTime(0.0f),
740  kmodState(0),
741  mouseButtonsState(0),
742  customParam(0)
743  {}
744 
745  Event(const Event&) = delete;
746  Event& operator=(const Event&) = delete;
747 
748  // Workaround for MSVC2013
749  Event(Event&& other)
750  : type(std::move(other.type)),
751  rTime(std::move(other.rTime)),
752  motionInput(std::move(other.motionInput)),
753  cameraInput(std::move(other.cameraInput)),
754  kmodState(std::move(other.kmodState)),
755  mousePos(std::move(other.mousePos)),
756  mouseButtonsState(std::move(other.mouseButtonsState)),
757  customParam(std::move(other.customParam)),
758  data(std::move(other.data))
759  {}
760 
761  Event& operator=(Event&& other)
762  {
763  type = std::move(other.type);
764  rTime = std::move(other.rTime);
765  motionInput = std::move(other.motionInput);
766  cameraInput = std::move(other.cameraInput);
767  kmodState = std::move(other.kmodState);
768  mousePos = std::move(other.mousePos);
769  mouseButtonsState = std::move(other.mouseButtonsState);
770  customParam = std::move(other.customParam);
771  data = std::move(other.data);
772  return *this;
773  }
774 
776  template<typename EventDataSubclass>
777  EventDataSubclass* GetData()
778  {
779  return static_cast<EventDataSubclass*>(data.get());
780  }
781 
783  template<typename EventDataSubclass>
784  const EventDataSubclass* GetData() const
785  {
786  return static_cast<EventDataSubclass*>(data.get());
787  }
788 
790  Event Clone() const
791  {
792  Event clone;
793 
794  clone.type = type;
795  clone.rTime = rTime;
796  clone.motionInput = motionInput;
797  clone.cameraInput = cameraInput;
798  clone.kmodState = kmodState;
799  clone.mousePos = mousePos;
800  clone.mouseButtonsState = mouseButtonsState;
801  clone.customParam = customParam;
802 
803  if (data != nullptr)
804  {
805  clone.data = data->Clone();
806  }
807 
808  return clone;
809  }
810 
813 
816  // TODO: gradually replace the usage of this with new CApplication's time functions
817  float rTime;
818 
822 
826 
829  unsigned int kmodState;
830 
834 
837  unsigned int mouseButtonsState;
838 
842 
844  std::unique_ptr<EventData> data;
845 };
846 
847 
850 
853 
855 std::string ParseEventType(EventType eventType);
856 
867 {
868 public:
870  static const int MAX_EVENT_QUEUE = 100;
871 
872 public:
874  CEventQueue();
876  ~CEventQueue();
877 
879  bool IsEmpty();
881  bool AddEvent(Event&& event);
883  Event GetEvent();
884 
885 protected:
886  CSDLMutexWrapper m_mutex;
887  Event m_fifo[MAX_EVENT_QUEUE];
888  int m_head;
889  int m_tail;
890  int m_total;
891 };
Event sent on user quit request.
Definition: event.h:96
Event sent on resolution change.
Definition: event.h:99
Additional data for joystick button event.
Definition: event.h:713
CDisplayText.
Definition: event.h:147
float rTime
Definition: event.h:817
MouseButton
Mouse button.
Definition: event.h:651
void InitializeEventTypeTexts()
Initializes static array with event type strings.
Definition: event.cpp:40
(unused)
Definition: event.h:153
InputSlot
Available slots for input bindings NOTE: When adding new values, remember to also update keyTable in ...
Definition: key.h:79
Additional data for mouse wheel event.
Definition: event.h:679
code battle interface
Definition: event.h:151
Additional data mouse button event.
Definition: event.h:664
Point struct and related functions.
CDisplayInfo.
Definition: event.h:149
Base class for additional event data.
Definition: event.h:603
std::string ParseEventType(EventType eventType)
Parses event type to string.
Definition: event.cpp:527
Event sent after releasing a mouse button.
Definition: event.h:60
Event sent after releasing a joystick button.
Definition: event.h:82
std::unique_ptr< EventData > data
Additional data for some events.
Definition: event.h:844
Math::Vector cameraInput
Definition: event.h:825
Event sent when mouse enters the window.
Definition: event.h:66
button that starts the code battle
Definition: event.h:589
Maximum value of standard events.
Definition: event.h:593
Event sent after moving joystick axes.
Definition: event.h:78
Additional data for text input event.
Definition: event.h:634
Global event queue.
Definition: event.h:866
Wrapper for safe creation/deletion of SDL_mutex.
Definition: sdl_mutex_wrapper.h:28
Additional data for keyboard event.
Definition: event.h:615
unsigned int kmodState
Definition: event.h:829
Event sent after pressing a mouse button.
Definition: event.h:58
Event sent when textures have to be reloaded.
Definition: event.h:101
Event sent when the app winddow gains focus.
Definition: event.h:85
const EventDataSubclass * GetData() const
Convenience function for getting appropriate EventData subclass.
Definition: event.h:784
Math::Vector motionInput
Definition: event.h:821
Event Clone() const
Returns a clone of this event.
Definition: event.h:790
CMainMap.
Definition: event.h:146
unsigned int mouseButtonsState
Definition: event.h:837
debug interface
Definition: event.h:152
Event sent after releasing a key.
Definition: event.h:73
2D point
Definition: point.h:50
CMainDialog and CStudio file selector.
Definition: event.h:154
Key-related macros and enums.
Additional data for joystick axis event.
Definition: event.h:696
EventType type
Type of event.
Definition: event.h:812
Event sent when mouse leaves the window.
Definition: event.h:68
Event sent on system quit request.
Definition: event.h:52
EventDataSubclass * GetData()
Convenience function for getting appropriate EventData subclass.
Definition: event.h:777
button that controls the code battle spectator camera
Definition: event.h:590
Vector struct and related functions.
object interface (CObjectInterface + CAuto classes)
Definition: event.h:145
Event sent after pressing a joystick button.
Definition: event.h:80
indicates end of writing scene (writing screenshot image)
Definition: event.h:587
all menu windows
Definition: event.h:150
Invalid event / no event.
Definition: event.h:47
Event sent after moving the mouse.
Definition: event.h:64
3D (3x1) vector
Definition: vector.h:53
long customParam
Definition: event.h:841
Frame update event.
Definition: event.h:55
Event sent when the app winddow loses focus.
Definition: event.h:87
Event sent after moving mouse wheel up or down.
Definition: event.h:62
There may be additional mouse buttons >= this value.
Definition: event.h:657
EventType GetUniqueEventType()
Returns an unique event type (above the standard IDs)
Definition: event.cpp:32
Event sent when user inputs some character.
Definition: event.h:75
EventType
Type of event message.
Definition: event.h:41
Event sent by system, interface or game.
Definition: event.h:735
Event sent after pressing a key.
Definition: event.h:71
CStudio.
Definition: event.h:148
CEdit focus.
Definition: event.h:106
Math::Point mousePos
Definition: event.h:833