Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/angle
Path: blob/main_old/util/Event.h
1693 views
1
//
2
// Copyright 2014 The ANGLE Project Authors. All rights reserved.
3
// Use of this source code is governed by a BSD-style license that can be
4
// found in the LICENSE file.
5
//
6
7
#ifndef SAMPLE_UTIL_EVENT_H
8
#define SAMPLE_UTIL_EVENT_H
9
10
#include "keyboard.h"
11
#include "mouse.h"
12
13
class Event
14
{
15
public:
16
struct MoveEvent
17
{
18
int X;
19
int Y;
20
};
21
22
struct SizeEvent
23
{
24
int Width;
25
int Height;
26
};
27
28
struct KeyEvent
29
{
30
Key Code;
31
bool Alt;
32
bool Control;
33
bool Shift;
34
bool System;
35
};
36
37
struct MouseMoveEvent
38
{
39
int X;
40
int Y;
41
};
42
43
struct MouseButtonEvent
44
{
45
MouseButton Button;
46
int X;
47
int Y;
48
};
49
50
struct MouseWheelEvent
51
{
52
int Delta;
53
};
54
55
enum EventType
56
{
57
EVENT_CLOSED, // The window requested to be closed
58
EVENT_MOVED, // The window has moved
59
EVENT_RESIZED, // The window was resized
60
EVENT_LOST_FOCUS, // The window lost the focus
61
EVENT_GAINED_FOCUS, // The window gained the focus
62
EVENT_TEXT_ENTERED, // A character was entered
63
EVENT_KEY_PRESSED, // A key was pressed
64
EVENT_KEY_RELEASED, // A key was released
65
EVENT_MOUSE_WHEEL_MOVED, // The mouse wheel was scrolled
66
EVENT_MOUSE_BUTTON_PRESSED, // A mouse button was pressed
67
EVENT_MOUSE_BUTTON_RELEASED, // A mouse button was released
68
EVENT_MOUSE_MOVED, // The mouse cursor moved
69
EVENT_MOUSE_ENTERED, // The mouse cursor entered the area of the window
70
EVENT_MOUSE_LEFT, // The mouse cursor left the area of the window
71
EVENT_TEST, // Event for testing purposes
72
};
73
74
EventType Type;
75
76
union
77
{
78
MoveEvent Move; // Move event parameters
79
SizeEvent Size; // Size event parameters
80
KeyEvent Key; // Key event parameters
81
MouseMoveEvent MouseMove; // Mouse move event parameters
82
MouseButtonEvent MouseButton; // Mouse button event parameters
83
MouseWheelEvent MouseWheel; // Mouse wheel event parameters
84
};
85
};
86
87
#endif // SAMPLE_UTIL_EVENT_H
88
89