Kale
Loading...
Searching...
No Matches
Events.hpp
Go to the documentation of this file.
1/*
2 Copyright 2022 Rishi Challa
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17#pragma once
18
20
21namespace Kale {
22
26 enum class ControllerAxis {
27 Left, Right
28 };
29
40
44 enum class Key {
45 Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
47 Tab, Q, W, E, R, T, Y, U, I, O, P, LeftBracket, RightBracket, Backslash,
48 A, S, D, F, G, H, J, K, L, Semicolon, Apostrophe, Enter,
51 };
52
57
58 public:
59
63 virtual void onWindowResize(Vector2ui oldSize, Vector2ui newSize) {}
64
68 virtual void onWindowLostFocus() {}
69
73 virtual void onWindowGainedFocus() {}
74
78 virtual void onControllerConnect(unsigned int controller) {}
79
83 virtual void onControllerDisconnect(unsigned int controller) {}
84
88 virtual void onControllerButtonPress(unsigned int controller, ControllerButton button) {}
89
93 virtual void onControllerButtonRelease(unsigned int controller, ControllerButton button) {}
94
98 virtual void onControllerHandle(unsigned int controller, ControllerAxis handle, float position) {}
99
103 virtual void onControllerJoystick(unsigned int controller, ControllerAxis joystick, Vector2f position) {}
104
108 virtual void onKeyPress(Key key) {}
109
113 virtual void onKeyRelease(Key key) {}
114
118 virtual void onMouseMove(Vector2f pos) {}
119
123 virtual void onMouseScroll(float scroll) {}
124
128 virtual void onLeftClick() {}
129
133 virtual void onMiddleClick() {}
134
138 virtual void onRightClick() {}
139
143 virtual void onLeftClickRelease() {}
144
148 virtual void onMiddleClickRelease() {}
149
153 virtual void onRightClickRelease() {}
154
158 virtual void onTouchBegin(unsigned int touch, Vector2f pos) {}
159
163 virtual void onTouchMove(unsigned int touch, Vector2f pos) {}
164
168 virtual void onTouchEnd(unsigned int touch) {}
169
170 friend class Window;
171 };
172}
virtual void onRightClickRelease()
Definition Events.hpp:153
virtual void onWindowResize(Vector2ui oldSize, Vector2ui newSize)
Definition Events.hpp:63
virtual void onMiddleClickRelease()
Definition Events.hpp:148
virtual void onTouchEnd(unsigned int touch)
Definition Events.hpp:168
virtual void onTouchBegin(unsigned int touch, Vector2f pos)
Definition Events.hpp:158
virtual void onLeftClick()
Definition Events.hpp:128
virtual void onControllerButtonPress(unsigned int controller, ControllerButton button)
Definition Events.hpp:88
virtual void onMouseMove(Vector2f pos)
Definition Events.hpp:118
virtual void onWindowLostFocus()
Definition Events.hpp:68
virtual void onControllerButtonRelease(unsigned int controller, ControllerButton button)
Definition Events.hpp:93
virtual void onTouchMove(unsigned int touch, Vector2f pos)
Definition Events.hpp:163
virtual void onControllerDisconnect(unsigned int controller)
Definition Events.hpp:83
virtual void onLeftClickRelease()
Definition Events.hpp:143
virtual void onControllerHandle(unsigned int controller, ControllerAxis handle, float position)
Definition Events.hpp:98
virtual void onKeyPress(Key key)
Definition Events.hpp:108
virtual void onControllerConnect(unsigned int controller)
Definition Events.hpp:78
virtual void onWindowGainedFocus()
Definition Events.hpp:73
virtual void onMiddleClick()
Definition Events.hpp:133
virtual void onKeyRelease(Key key)
Definition Events.hpp:113
virtual void onMouseScroll(float scroll)
Definition Events.hpp:123
virtual void onRightClick()
Definition Events.hpp:138
virtual void onControllerJoystick(unsigned int controller, ControllerAxis joystick, Vector2f position)
Definition Events.hpp:103
ControllerButton
Definition Events.hpp:33
constexpr float E
Definition Constants.hpp:29
ControllerAxis
Definition Events.hpp:26