All Classes Files Functions Variables Typedefs Pages
InputEvent.hpp
Go to the documentation of this file.
1 #pragma once
2 
10 #include "KeyCode.hpp"
11 
12 #include <cstdint>
13 #include <cstring>
14 
15 namespace lumina {
16 
18 enum class InputType : uint8_t {
19  KeyReleased,
20  KeyPressed,
21  KeyHold,
22  Char,
23 
24  LMousePressed,
25  MMousePressed,
26  RMousePressed,
27  LMouseReleased,
28  MMouseReleased,
29  RMouseReleased,
30  MouseMoveDir,
31  MouseMovePos,
32  MouseScroll
33 };
34 
36 struct MouseInput {
37  union {
38  struct {
39  float x;
40  float y;
41  };
42  struct {
43  float scrollX;
44  float scrollY;
45  };
46  };
47 };
48 
50 struct KeyInput {
51  KeyCode key;
52  unsigned char c;
53 };
54 
55 // input event
56 struct InputEvent {
57  InputType type;
58 
59  union {
62  };
63 
64  InputEvent() {
65  memset(this, 0, sizeof(*this));
66  }
67 };
68 
70 enum class EventResult {
71  Skipped,
72  Processed
73 };
74 
75 } // namespace lumina
KeyCode key
Contains the KeyCode of the pressed/released key.
Definition: InputEvent.hpp:51
Definition: InputEvent.hpp:56
float scrollX
Scroll delta (x)
Definition: InputEvent.hpp:43
float x
Absolute position or delta of mouse movement (x axis)
Definition: InputEvent.hpp:39
Provides enum class for all keys.
MouseInput mouseInput
Data for mouse input.
Definition: InputEvent.hpp:61
Additional data about a mouse input.
Definition: InputEvent.hpp:36
Additional data about a key input.
Definition: InputEvent.hpp:50
float scrollY
Scroll delta (y)
Definition: InputEvent.hpp:44
unsigned char c
Contains the charachter of a charachter input.
Definition: InputEvent.hpp:52
KeyInput keyInput
Data for key input.
Definition: InputEvent.hpp:60
InputType type
Type of the event.
Definition: InputEvent.hpp:57
float y
Absolute position or delta of mouse movement (y axis)
Definition: InputEvent.hpp:40