PeriDyno 1.0.0
Loading...
Searching...
No Matches
InputModule.h
Go to the documentation of this file.
1
16#pragma once
17#include "Module.h"
18#include "Camera.h"
19
21
22namespace dyno
23{
25 {
30 };
31
33 {
38 };
39
41 {
49 PKEY_0 = 48,
50 PKEY_1 = 49,
51 PKEY_2 = 50,
52 PKEY_3 = 51,
53 PKEY_4 = 52,
54 PKEY_5 = 53,
55 PKEY_6 = 54,
56 PKEY_7 = 55,
57 PKEY_8 = 56,
58 PKEY_9 = 57,
61 PKEY_A = 65,
62 PKEY_B = 66,
63 PKEY_C = 67,
64 PKEY_D = 68,
65 PKEY_E = 69,
66 PKEY_F = 70,
67 PKEY_G = 71,
68 PKEY_H = 72,
69 PKEY_I = 73,
70 PKEY_J = 74,
71 PKEY_K = 75,
72 PKEY_L = 76,
73 PKEY_M = 77,
74 PKEY_N = 78,
75 PKEY_O = 79,
76 PKEY_P = 80,
77 PKEY_Q = 81,
78 PKEY_R = 82,
79 PKEY_S = 83,
80 PKEY_T = 84,
81 PKEY_U = 85,
82 PKEY_V = 86,
83 PKEY_W = 87,
84 PKEY_X = 88,
85 PKEY_Y = 89,
86 PKEY_Z = 90,
95 PKEY_TAB = 258,
102 PKEY_UP = 265,
106 PKEY_END = 269,
112 PKEY_F1 = 290,
113 PKEY_F2 = 291,
114 PKEY_F3 = 292,
115 PKEY_F4 = 293,
116 PKEY_F5 = 294,
117 PKEY_F6 = 295,
118 PKEY_F7 = 296,
119 PKEY_F8 = 297,
120 PKEY_F9 = 298,
121 PKEY_F10 = 299,
122 PKEY_F11 = 300,
123 PKEY_F12 = 301,
124 PKEY_F13 = 302,
125 PKEY_F14 = 303,
126 PKEY_F15 = 304,
127 PKEY_F16 = 305,
128 PKEY_F17 = 306,
129 PKEY_F18 = 307,
130 PKEY_F19 = 308,
131 PKEY_F20 = 309,
132 PKEY_F21 = 310,
133 PKEY_F22 = 311,
134 PKEY_F23 = 312,
135 PKEY_F24 = 313,
136 PKEY_F25 = 314,
162 };
163
165 {
167 MB_SHIFT = 0x0001, //If the Shift keys were held down.
168 MB_CONTROL = 0x0002, //If the Control keys were held down.
169 MB_ALT = 0x0004, //If the Alt keys were held down.
170 MB_SUPER = 0x0008, //If the Super keys were held down.
171 MB_CAPS_LOCK = 0x0010, //If the Caps Lock key is enabled.
172 MB_NUM_LOCK = 0x0020 //If the Num Lock key is enabled.
173 };
174
188
190 {
191 bool operator==(const PMouseEvent& event) {
192 return buttonType == event.buttonType && actionType == event.actionType && mods == event.mods;
193 };
194
195 bool operator!=(const PMouseEvent& event) {
196 return buttonType != event.buttonType || actionType == event.actionType || mods == event.mods;
197 };
198
199 bool shiftKeyPressed() { return (mods & PModifierBits::MB_SHIFT) != 0; }
201 bool altKeyPressed() { return (mods & PModifierBits::MB_ALT) != 0; }
202 bool superKeyPressed() { return (mods & PModifierBits::MB_SUPER) != 0; }
205
207
209
211
213
214 std::shared_ptr<Camera> camera;
215
216 float x;
217 float y;
218 };
219
220 class InputModule : public Module
221 {
222 public:
223 InputModule();
224 virtual ~InputModule();
225
226 std::string getModuleType() final { return "InputModule"; }
227 };
228}
std::string getModuleType() final
virtual ~InputModule()
Module(std::string name="default")
Definition Module.cpp:7
This is an implementation of AdditiveCCD based on peridyno.
Definition Array.h:25
PModifierBits
@ MB_CAPS_LOCK
@ MB_CONTROL
@ MB_NO_MODIFIER
@ MB_SHIFT
@ MB_SUPER
@ MB_NUM_LOCK
PActionType
Definition InputModule.h:33
@ AT_RELEASE
Definition InputModule.h:35
@ AT_PRESS
Definition InputModule.h:36
@ AT_UNKOWN
Definition InputModule.h:34
@ AT_REPEAT
Definition InputModule.h:37
PKeyboardType
Definition InputModule.h:41
@ PKEY_RIGHT_CONTROL
@ PKEY_P
Definition InputModule.h:76
@ PKEY_KP_MULTIPLY
@ PKEY_S
Definition InputModule.h:79
@ PKEY_LEFT
@ PKEY_APOSTROPHE
Definition InputModule.h:44
@ PKEY_KP_9
@ PKEY_F4
@ PKEY_KP_8
@ PKEY_KP_3
@ PKEY_F6
@ PKEY_GRAVE_ACCENT
Definition InputModule.h:90
@ PKEY_A
Definition InputModule.h:61
@ PKEY_F25
@ PKEY_KP_7
@ PKEY_T
Definition InputModule.h:80
@ PKEY_RIGHT_ALT
@ PKEY_F2
@ PKEY_KP_4
@ PKEY_NUM_LOCK
@ PKEY_LEFT_BRACKET
Definition InputModule.h:87
@ PKEY_4
Definition InputModule.h:53
@ PKEY_KP_ADD
@ PKEY_H
Definition InputModule.h:68
@ PKEY_WORLD_1
Definition InputModule.h:91
@ PKEY_F5
@ PKEY_F8
@ PKEY_O
Definition InputModule.h:75
@ PKEY_1
Definition InputModule.h:50
@ PKEY_Q
Definition InputModule.h:77
@ PKEY_EQUAL
Definition InputModule.h:60
@ PKEY_F20
@ PKEY_7
Definition InputModule.h:56
@ PKEY_F11
@ PKEY_F7
@ PKEY_SPACE
Definition InputModule.h:43
@ PKEY_F21
@ PKEY_BACKSPACE
Definition InputModule.h:96
@ PKEY_Y
Definition InputModule.h:85
@ PKEY_F17
@ PKEY_D
Definition InputModule.h:64
@ PKEY_LEFT_SHIFT
@ PKEY_J
Definition InputModule.h:70
@ PKEY_F15
@ PKEY_R
Definition InputModule.h:78
@ PKEY_PERIOD
Definition InputModule.h:47
@ PKEY_C
Definition InputModule.h:63
@ PKEY_RIGHT_SHIFT
@ PKEY_F22
@ PKEY_5
Definition InputModule.h:54
@ PKEY_LEFT_ALT
@ PKEY_SLASH
Definition InputModule.h:48
@ PKEY_3
Definition InputModule.h:52
@ PKEY_LEFT_SUPER
@ PKEY_N
Definition InputModule.h:74
@ PKEY_KP_SUBTRACT
@ PKEY_KP_6
@ PKEY_KP_0
@ PKEY_PAUSE
@ PKEY_F23
@ PKEY_KP_DIVIDE
@ PKEY_F24
@ PKEY_RIGHT
Definition InputModule.h:99
@ PKEY_SCROLL_LOCK
@ PKEY_F1
@ PKEY_LEFT_CONTROL
@ PKEY_I
Definition InputModule.h:69
@ PKEY_F18
@ PKEY_F10
@ PKEY_V
Definition InputModule.h:82
@ PKEY_F
Definition InputModule.h:66
@ PKEY_KP_1
@ PKEY_COMMA
Definition InputModule.h:45
@ PKEY_K
Definition InputModule.h:71
@ PKEY_DOWN
@ PKEY_SEMICOLON
Definition InputModule.h:59
@ PKEY_F16
@ PKEY_F14
@ PKEY_F9
@ PKEY_B
Definition InputModule.h:62
@ PKEY_PAGE_UP
@ PKEY_END
@ PKEY_W
Definition InputModule.h:83
@ PKEY_MINUS
Definition InputModule.h:46
@ PKEY_G
Definition InputModule.h:67
@ PKEY_INSERT
Definition InputModule.h:97
@ PKEY_PRINT_SCREEN
@ PKEY_BACKSLASH
Definition InputModule.h:88
@ PKEY_UNKNOWN
Definition InputModule.h:42
@ PKEY_8
Definition InputModule.h:57
@ PKEY_KP_DECIMAL
@ PKEY_2
Definition InputModule.h:51
@ PKEY_6
Definition InputModule.h:55
@ PKEY_E
Definition InputModule.h:65
@ PKEY_RIGHT_BRACKET
Definition InputModule.h:89
@ PKEY_F3
@ PKEY_ESCAPE
Definition InputModule.h:93
@ PKEY_UP
@ PKEY_KP_5
@ PKEY_RIGHT_SUPER
@ PKEY_F19
@ PKEY_F12
@ PKEY_HOME
@ PKEY_0
Definition InputModule.h:49
@ PKEY_Z
Definition InputModule.h:86
@ PKEY_U
Definition InputModule.h:81
@ PKEY_ENTER
Definition InputModule.h:94
@ PKEY_9
Definition InputModule.h:58
@ PKEY_F13
@ PKEY_X
Definition InputModule.h:84
@ PKEY_CAPS_LOCK
@ PKEY_KP_EQUAL
@ PKEY_WORLD_2
Definition InputModule.h:92
@ PKEY_KP_2
@ PKEY_KP_ENTER
@ PKEY_M
Definition InputModule.h:73
@ PKEY_TAB
Definition InputModule.h:95
@ PKEY_DELETE
Definition InputModule.h:98
@ PKEY_L
Definition InputModule.h:72
@ PKEY_PAGE_DOWN
PButtonType
Definition InputModule.h:25
@ BT_MIDDLE
Definition InputModule.h:29
@ BT_UNKOWN
Definition InputModule.h:26
@ BT_LEFT
Definition InputModule.h:27
@ BT_RIGHT
Definition InputModule.h:28
PKeyboardType key
PModifierBits mods
TRay3D< float > ray
PButtonType buttonType
std::shared_ptr< Camera > camera
bool operator!=(const PMouseEvent &event)
bool operator==(const PMouseEvent &event)
PModifierBits mods
PActionType actionType