TDME2  1.9.200
GUIMiniScript.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <array>
4 #include <memory>
5 #include <string>
6 #include <unordered_set>
7 #include <vector>
8 
9 #include <tdme/tdme.h>
10 #include <tdme/gui/fwd-tdme.h>
15 
16 using std::array;
17 using std::string;
18 using std::unique_ptr;
19 using std::unordered_set;
20 using std::vector;
21 
22 using tdme::gui::GUI;
27 
28 /**
29  * GUI mini script
30  */
32 public:
33  // forbid class copy
35 
36  /**
37  * Public constructor
38  * @param screenNode screen node
39  */
41 
42  /**
43  * Destructor
44  */
45  virtual ~GUIMiniScript();
46 
47  // overridden methods
48  const string getBaseClass();
49  const vector<string> getTranspilationUnits();
50  void registerStateMachineStates() override;
51  void registerMethods() override;
52  void registerVariables() override;
53 
54  /**
55  * @return release next screen node
56  */
58  return nextScreenNode.release();
59  }
60 
61  /**
62  * @return if screen has been popped
63  */
64  inline bool isPopped() {
65  return popped;
66  }
67 
68  /**
69  * Collect HID events
70  * @param mouseEvents mouse events
71  * @param keyEvents keyboard events
72  */
73  void collectHIDEvents(vector<GUIMouseEvent>& mouseEvents, vector<GUIKeyboardEvent>& keyEvents);
74 
75 private:
76  STATIC_DLL_IMPEXT static const vector<string> CONTEXTFUNCTION_GUI;
77 
78  GUIScreenNode* screenNode { nullptr };
79  unique_ptr<GUIScreenNode> nextScreenNode;
80  bool popped { false };
81 
82  // keys
83  unordered_set<int32_t> keyboardChars;
84  unordered_set<int32_t> keyboardKeys;
86  bool keyboardMetaDown { false };
87  bool keyboardControlDown { false };
88  bool keyboardAltDown { false };
89  bool keyboardShiftDown { false };
90 
91  // mouse
92  int mouseX { -1 };
93  int mouseY { -1 };
94  int mouseXUnscaled { -1 };
95  int mouseYUnscaled { -1 };
96  array<bool, 8> mouseDown {{ false, false, false, false, false, false, false, false }};
97  array<bool, 8> mouseUp {{ false, false, false, false, false, false, false, false }};
98  array<bool, 8> mouseDragging {{ false, false, false, false, false, false, false, false }};
99  bool mouseMoved = false;
100  float mouseWheelX { 0.0f };
101  float mouseWheelY { 0.0f };
102  float mouseWheelZ { 0.0f };
103 
104 };
GUI module class.
Definition: GUI.h:64
GUI screen node that represents a screen that can be rendered via GUI system.
Definition: GUIScreenNode.h:72
void collectHIDEvents(vector< GUIMouseEvent > &mouseEvents, vector< GUIKeyboardEvent > &keyEvents)
Collect HID events.
unique_ptr< GUIScreenNode > nextScreenNode
Definition: GUIMiniScript.h:79
unordered_set< int32_t > keyboardKeys
Definition: GUIMiniScript.h:84
static STATIC_DLL_IMPEXT const vector< string > CONTEXTFUNCTION_GUI
Definition: GUIMiniScript.h:76
GUIMiniScript(GUIScreenNode *screenNode)
Public constructor.
const vector< string > getTranspilationUnits()
unordered_set< int32_t > keyboardChars
Definition: GUIMiniScript.h:83
GUIScreenNode * releaseNextScreenNode()
Definition: GUIMiniScript.h:57
#define STATIC_DLL_IMPEXT
Definition: tdme.h:15
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6