Symphony Of Empires
event.hpp
Go to the documentation of this file.
1 // Eng3D - General purpouse game engine
2 // Copyright (C) 2021, Eng3D contributors
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 //
17 // ----------------------------------------------------------------------------
18 // Name:
19 // event.hpp
20 //
21 // Abstract:
22 // Does important stuff.
23 // ----------------------------------------------------------------------------
24 
25 #pragma once
26 
27 #include <functional>
28 #include <glm/vec2.hpp>
29 
30 namespace Eng3D::Event {
31  struct Key {
32  enum class Type : unsigned char {
34  NONE,
35  // Alphabet
36  A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z,
37  // Numerals
39  // Function keys
40  F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12,
41  UP, DOWN, LEFT, RIGHT,
42  // Miscellaneous
43  SPACE,
44  BACKSPACE,
45  ESC,
46  TILDE,
47  };
50  bool hold;
52  };
53 
54  struct MouseButton {
55  enum class Type : unsigned char {
56  NONE,
57  LEFT, MIDDLE, RIGHT,
58  };
62  bool hold;
64  glm::ivec2 pos; // Absolute position of the mouse
65  };
66 
67  struct MouseMotion {
68  glm::ivec2 pos; // Absolute position of the mouse
69  glm::ivec2 delta; // Difference from previous and current mouse position
70  };
71 
72  struct MouseWheel {
73  glm::ivec2 wheel; // Wheel relative movement
74  glm::ivec2 pos; // Absolute position of the mouse
75  };
76 
77  glm::ivec2 get_mouse_pos();
78 }
glm::ivec2 get_mouse_pos()
Definition: event.cpp:110
Eng3D::Event::Key::Type type
Definition: event.hpp:48
Eng3D::Event::Key::Type from_sdl(int sdl)
Definition: event.cpp:32
bool hold
Whetever the key is being held.
Definition: event.hpp:50
Eng3D::Event::MouseButton::Type from_sdl(int sdl)
Definition: event.cpp:101
Eng3D::Event::MouseButton::Type type
Button that is checked.
Definition: event.hpp:60
bool hold
Whetever the button is being held.
Definition: event.hpp:62