-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnormal_input_single_component.h
62 lines (46 loc) · 1.63 KB
/
normal_input_single_component.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
#include "core/input/controls.h"
#include <cstdint>
namespace hg {
class WindowSystem;
class ImguiFetchSystem;
/** `NormalInputSingleComponent` contains information about keyboard and mouse input changes between normal frames. */
class NormalInputSingleComponent final {
public:
/** Return whether specified `control` is down. */
bool is_down(Control control) const;
/** Return whether specified `control` is pressed. */
bool is_pressed(Control control) const;
/** Return whether specified `control` is released. */
bool is_released(Control control) const;
/** Return horizontal mouse position. */
int32_t get_mouse_x() const;
/** Return vertical mouse position. */
int32_t get_mouse_y() const;
/** Return delta horizontal mouse position. */
int32_t get_delta_mouse_x() const;
/** Return delta vertical mouse position. */
int32_t get_delta_mouse_y() const;
/** Return mouse wheel delta. */
int32_t get_mouse_wheel() const;
/** Return UTF-8 text entered since last update. */
const char* get_text() const;
private:
int32_t m_mouse_x = 0;
int32_t m_mouse_y = 0;
int32_t m_mouse_delta_x = 0;
int32_t m_mouse_delta_y = 0;
int32_t m_mouse_wheel = 0;
bool m_previous_mouse_buttons[5] {};
bool m_mouse_buttons[5] {};
bool m_previous_keys[512] {};
bool m_keys[512] {};
char m_text[32] {};
bool m_disable_keyboard = false;
bool m_previous_disable_keyboard = false;
bool m_disable_mouse = false;
bool m_previous_disable_mouse = false;
friend class WindowSystem;
friend class ImguiFetchSystem;
};
} // namespace hg