GlistEngine
Loading...
Searching...
No Matches
gWindowEvents.h
Go to the documentation of this file.
1/*
2* gEvent.h
3*
4* Created on: June 24, 2023
5* Author: Metehan Gezer
6*/
7
8#ifndef GWINDOWEVENTS_H_
9#define GWINDOWEVENTS_H_
10
11#include "gEvent.h"
12#include "gUtils.h"
13
20
21class gKeyEvent : public gEvent {
22public:
23 int getKeyCode() const { return keycode; }
24
26protected:
27 gKeyEvent(const int keycode)
28 : keycode(keycode) {}
29
31};
32
33class gCharTypedEvent : public gEvent {
34public:
35 gCharTypedEvent(const unsigned int keycode)
36 : keycode(keycode) {}
37
38 unsigned int getCharacter() const { return keycode; }
39
42private:
43 unsigned int keycode;
44};
45
47public:
48 gKeyPressedEvent(const int keycode, bool isrepeat = false)
50 isrepeat(isrepeat) {}
51
52 bool isRepeat() const { return isrepeat; }
53
55private:
56 bool isrepeat;
57};
58
66
67
68class gMouseMovedEvent : public gEvent {
69public:
70 gMouseMovedEvent(float x, float y, gCursorMode cursormode)
71 : mousex(x),
72 mousey(y),
73 cursormode(cursormode) {}
74
75 float getX() const { return mousex; }
76 float getY() const { return mousey; }
77 gCursorMode getCursorMode() const { return cursormode; }
78
81private:
82 float mousex, mousey;
83 gCursorMode cursormode;
84};
85
87public:
88 gMouseScrolledEvent(const int offsetx, const int offsety)
89 : offsetx(offsetx),
90 offsety(offsety) {}
91
92 int getOffsetX() const { return offsetx; }
93 int getOffsetY() const { return offsety; }
94
95
98private:
99 int offsetx, offsety;
100};
101
102class gMouseButtonEvent : public gEvent {
103public:
104 int getMouseButton() const { return button; }
105 int getX() const { return x; }
106 int getY() const { return y; }
107
109protected:
110 gMouseButtonEvent(const int button, const int x, const int y)
111 : button(button), x(x), y(y) {}
112
114 int x, y;
115};
116
118public:
119 gMouseButtonPressedEvent(const int button, const int x, const int y)
121
123};
124
132
134public:
135 gWindowResizeEvent(int width, int height)
136 : width(width), height(height) {}
137
138 int getWidth() const { return width; }
139 int getHeight() const { return height; }
140
143private:
144 int width, height;
145};
146
148public:
149 gWindowScaleChangedEvent(int width, int height, float scalex, float scaley)
150 : width(width), height(height), scalex(scalex), scaley(scaley) {}
151
152 int getWidth() const { return width; }
153 int getHeight() const { return height; }
154 float getScaleX() const { return scalex; }
155 float getScaleY() const { return scaley; }
156
159private:
160 int width, height;
161 float scalex, scaley;
162};
163
171
179
187
195
197public:
198 gJoystickConnectEvent(int joystickId, bool isgamepad)
199 : joystickid(joystickId), isgamepad(isgamepad) {}
200
201 int getJoystickId() const { return joystickid; }
202 bool isGamepad() const { return isgamepad; }
203
206private:
207 int joystickid;
208 bool isgamepad;
209};
210
212public:
214 : joystickid(joystickId) {}
215
216 int getJoystickId() const { return joystickid; }
217
220private:
221 int joystickid;
222};
223
230
244
251
252class gTouchEvent : public gEvent {
253public:
254 gTouchEvent(int inputCount, TouchInput* inputs, int actionIndex, ActionType action) : inputs(inputs), inputcount(inputCount), action(action), actionindex(actionIndex) {}
255
256 int getInputCount() const { return inputcount; }
257 TouchInput* getInputs() const { return inputs; }
258 int getActionIndex() const { return actionindex; }
259 ActionType getAction() const { return action; }
260
263private:
264 int inputcount;
265 TouchInput* inputs;
266 int actionindex;
267 ActionType action;
268};
269
277
279public:
280 gDeviceOrientationChangedEvent(DeviceOrientation orientation) : orientation(orientation) {}
281
282 DeviceOrientation getOrientation() const { return orientation; }
283
286private:
287 DeviceOrientation orientation;
288};
289
298
307
308#endif /* GWINDOWEVENTS_H_ */
Definition gWindowEvents.h:290
gAppPauseEvent()
Definition gWindowEvents.h:292
Definition gWindowEvents.h:299
gAppResumeEvent()
Definition gWindowEvents.h:301
Definition gWindowEvents.h:33
unsigned int getCharacter() const
Definition gWindowEvents.h:38
gCharTypedEvent(const unsigned int keycode)
Definition gWindowEvents.h:35
Definition gWindowEvents.h:278
gDeviceOrientationChangedEvent(DeviceOrientation orientation)
Definition gWindowEvents.h:280
DeviceOrientation getOrientation() const
Definition gWindowEvents.h:282
Definition gEvent.h:32
Definition gWindowEvents.h:196
bool isGamepad() const
Definition gWindowEvents.h:202
int getJoystickId() const
Definition gWindowEvents.h:201
gJoystickConnectEvent(int joystickId, bool isgamepad)
Definition gWindowEvents.h:198
Definition gWindowEvents.h:211
int getJoystickId() const
Definition gWindowEvents.h:216
gJoystickDisconnectEvent(int joystickId)
Definition gWindowEvents.h:213
gKeyEvent(const int keycode)
Definition gWindowEvents.h:27
int getKeyCode() const
Definition gWindowEvents.h:23
int keycode
Definition gWindowEvents.h:30
Definition gWindowEvents.h:46
bool isRepeat() const
Definition gWindowEvents.h:52
gKeyPressedEvent(const int keycode, bool isrepeat=false)
Definition gWindowEvents.h:48
Definition gWindowEvents.h:59
gKeyReleasedEvent(const int keycode)
Definition gWindowEvents.h:61
int button
Definition gWindowEvents.h:113
int getX() const
Definition gWindowEvents.h:105
int getMouseButton() const
Definition gWindowEvents.h:104
int x
Definition gWindowEvents.h:114
int y
Definition gWindowEvents.h:114
int getY() const
Definition gWindowEvents.h:106
gMouseButtonEvent(const int button, const int x, const int y)
Definition gWindowEvents.h:110
Definition gWindowEvents.h:117
gMouseButtonPressedEvent(const int button, const int x, const int y)
Definition gWindowEvents.h:119
Definition gWindowEvents.h:125
gMouseButtonReleasedEvent(const int button, const int x, const int y)
Definition gWindowEvents.h:127
Definition gWindowEvents.h:68
gMouseMovedEvent(float x, float y, gCursorMode cursormode)
Definition gWindowEvents.h:70
gCursorMode getCursorMode() const
Definition gWindowEvents.h:77
float getX() const
Definition gWindowEvents.h:75
float getY() const
Definition gWindowEvents.h:76
Definition gWindowEvents.h:86
int getOffsetY() const
Definition gWindowEvents.h:93
gMouseScrolledEvent(const int offsetx, const int offsety)
Definition gWindowEvents.h:88
int getOffsetX() const
Definition gWindowEvents.h:92
Definition gWindowEvents.h:252
gTouchEvent(int inputCount, TouchInput *inputs, int actionIndex, ActionType action)
Definition gWindowEvents.h:254
int getActionIndex() const
Definition gWindowEvents.h:258
int getInputCount() const
Definition gWindowEvents.h:256
ActionType getAction() const
Definition gWindowEvents.h:259
TouchInput * getInputs() const
Definition gWindowEvents.h:257
Definition gWindowEvents.h:164
gWindowFocusEvent()
Definition gWindowEvents.h:166
Definition gWindowEvents.h:172
gWindowLoseFocusEvent()
Definition gWindowEvents.h:174
Definition gWindowEvents.h:180
gWindowMouseEnterEvent()
Definition gWindowEvents.h:182
Definition gWindowEvents.h:188
gWindowMouseExitEvent()
Definition gWindowEvents.h:190
Definition gWindowEvents.h:133
int getHeight() const
Definition gWindowEvents.h:139
int getWidth() const
Definition gWindowEvents.h:138
gWindowResizeEvent(int width, int height)
Definition gWindowEvents.h:135
Definition gWindowEvents.h:147
int getHeight() const
Definition gWindowEvents.h:153
gWindowScaleChangedEvent(int width, int height, float scalex, float scaley)
Definition gWindowEvents.h:149
float getScaleY() const
Definition gWindowEvents.h:155
int getWidth() const
Definition gWindowEvents.h:152
float getScaleX() const
Definition gWindowEvents.h:154
#define G_EVENT_CLASS_CATEGORY(category)
Definition gEvent.h:91
@ EVENTCATEGORY_KEYBOARD
Definition gEvent.h:17
@ EVENTCATEGORY_JOYSTICK
Definition gEvent.h:20
@ EVENTCATEGORY_TOUCHSCREEN
Definition gEvent.h:21
@ EVENTCATEGORY_APP
Definition gEvent.h:15
@ EVENTCATEGORY_MOUSE
Definition gEvent.h:18
@ EVENTCATEGORY_MOUSE_BUTTON
Definition gEvent.h:19
@ EVENTCATEGORY_INPUT
Definition gEvent.h:16
#define G_EVENT_CLASS_TYPE(type)
Definition gEvent.h:86
ActionType
Definition gWindowEvents.h:231
@ ACTIONTYPE_MOVE
Definition gWindowEvents.h:234
@ ACTIONTYPE_HOVER_MOVE
Definition gWindowEvents.h:239
@ ACTIONTYPE_POINTER_UP
Definition gWindowEvents.h:238
@ ACTIONTYPE_HOVER_ENTER
Definition gWindowEvents.h:241
@ ACTIONTYPE_CANCEL
Definition gWindowEvents.h:235
@ ACTIONTYPE_DOWN
Definition gWindowEvents.h:232
@ ACTIONTYPE_UP
Definition gWindowEvents.h:233
@ ACTIONTYPE_SCROLL
Definition gWindowEvents.h:240
@ ACTIONTYPE_OUTSIDE
Definition gWindowEvents.h:236
@ ACTIONTYPE_HOVER_EXIT
Definition gWindowEvents.h:242
@ ACTIONTYPE_POINTER_DOWN
Definition gWindowEvents.h:237
gCursorMode
Definition gWindowEvents.h:14
@ CURSORMODE_NORMAL
Definition gWindowEvents.h:15
@ CURSORMODE_HIDDEN
Definition gWindowEvents.h:16
@ CURSORMODE_DISABLED
Definition gWindowEvents.h:17
@ CURSORMODE_RELATIVE
Definition gWindowEvents.h:18
InputType
Definition gWindowEvents.h:224
@ INPUTTYPE_MOUSE
Definition gWindowEvents.h:228
@ INPUTTYPE_FINGER
Definition gWindowEvents.h:226
@ INPUTTYPE_STYLUS
Definition gWindowEvents.h:227
@ INPUTTYPE_UNKNOWN
Definition gWindowEvents.h:225
DeviceOrientation
Definition gWindowEvents.h:270
@ DEVICEORIENTATION_REVERSE_LANDSCAPE
Definition gWindowEvents.h:274
@ DEVICEORIENTATION_REVERSE_PORTRAIT
Definition gWindowEvents.h:275
@ DEVICEORIENTATION_UNSPECIFIED
Definition gWindowEvents.h:271
@ DEVICEORIENTATION_LANDSCAPE
Definition gWindowEvents.h:272
@ DEVICEORIENTATION_PORTRAIT
Definition gWindowEvents.h:273
Definition gWindowEvents.h:245
InputType type
Definition gWindowEvents.h:246
int fingerid
Definition gWindowEvents.h:247
int y
Definition gWindowEvents.h:249
int x
Definition gWindowEvents.h:249
int pointerindex
Definition gWindowEvents.h:248