Nebula
Loading...
Searching...
No Matches
displayevent.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
13#include "core/types.h"
14#include "input/key.h"
15#include "input/char.h"
16#include "input/mousebutton.h"
17#include "math/vec2.h"
18#include "coregraphics/window.h"
19
20//------------------------------------------------------------------------------
21namespace CoreGraphics
22{
92
93//------------------------------------------------------------------------------
96inline
98 code(InvalidCode),
99 windowId(Ids::InvalidId32),
100 absMousePos(0.0f, 0.0f),
101 normMousePos(0.0f, 0.0f),
102 keyCode(Input::Key::InvalidKey),
103 charCode(0),
104 mouseButtonCode(Input::MouseButton::InvalidMouseButton)
105{
106 // empty
107}
108
109//------------------------------------------------------------------------------
112inline
114 code(c),
115 windowId(Ids::InvalidId32),
116 absMousePos(0.0f, 0.0f),
117 normMousePos(0.0f, 0.0f),
118 keyCode(Input::Key::InvalidKey),
119 charCode(0),
120 mouseButtonCode(Input::MouseButton::InvalidMouseButton)
121{
122 // empty
123}
124
125
126//------------------------------------------------------------------------------
129inline
131 code(c),
132 windowId(wnd),
133 absMousePos(0.0f, 0.0f),
134 normMousePos(0.0f, 0.0f),
135 keyCode(Input::Key::InvalidKey),
136 charCode(0),
137 mouseButtonCode(Input::MouseButton::InvalidMouseButton)
138{
139 // empty
140}
141
142//------------------------------------------------------------------------------
145inline
146DisplayEvent::DisplayEvent(Code c, const Math::vec2& absPos, const Math::vec2& normPos) :
147 code(c),
148 windowId(Ids::InvalidId32),
149 absMousePos(absPos),
150 normMousePos(normPos),
151 keyCode(Input::Key::InvalidKey),
152 charCode(0),
153 mouseButtonCode(Input::MouseButton::InvalidMouseButton)
154{
155 // empty
156}
157
158//------------------------------------------------------------------------------
161inline
163 code(c),
164 windowId(Ids::InvalidId32),
165 absMousePos(0.0f, 0.0f),
166 normMousePos(0.0f, 0.0f),
167 keyCode(k),
168 charCode(0),
169 mouseButtonCode(Input::MouseButton::InvalidMouseButton)
170{
171 // empty
172}
173
174//------------------------------------------------------------------------------
177inline
179 code(c),
180 windowId(Ids::InvalidId32),
181 absMousePos(0.0f, 0.0f),
182 normMousePos(0.0f, 0.0f),
183 keyCode(Input::Key::InvalidKey),
184 charCode(chr),
185 mouseButtonCode(Input::MouseButton::InvalidMouseButton)
186{
187 // empty
188}
189
190//------------------------------------------------------------------------------
193inline
195 code(c),
196 windowId(Ids::InvalidId32),
197 absMousePos(absPos),
198 normMousePos(normPos),
199 keyCode(Input::Key::InvalidKey),
200 charCode(0),
201 mouseButtonCode(b)
202{
203 // empty
204}
205
206//------------------------------------------------------------------------------
211{
212 return this->code;
213}
214
215//------------------------------------------------------------------------------
220{
221 return this->windowId;
222}
223
224//------------------------------------------------------------------------------
227inline const Math::vec2&
229{
230 return this->absMousePos;
231}
232
233//------------------------------------------------------------------------------
236inline const Math::vec2&
238{
239 return this->normMousePos;
240}
241
242//------------------------------------------------------------------------------
245inline Input::Key::Code
247{
248 return this->keyCode;
249}
250
251//------------------------------------------------------------------------------
254inline Input::Char
256{
257 return this->charCode;
258}
259
260//------------------------------------------------------------------------------
265{
266 return this->mouseButtonCode;
267}
268
269} // namespace CoreGraphics
270//------------------------------------------------------------------------------
271
A translated character code.
Display events are sent by the display device to registered display event handlers.
Definition displayevent.h:24
Code code
Definition displayevent.h:84
Math::vec2 normMousePos
Definition displayevent.h:87
Code GetEventCode() const
get event code
Definition displayevent.h:210
Input::Key::Code GetKey() const
get key code
Definition displayevent.h:246
DisplayEvent()
default constructor
Definition displayevent.h:97
CoreGraphics::WindowId windowId
Definition displayevent.h:85
CoreGraphics::WindowId GetWindowId() const
get window id
Definition displayevent.h:219
Input::Char charCode
Definition displayevent.h:89
Input::MouseButton::Code GetMouseButton() const
get mouse button code
Definition displayevent.h:264
const Math::vec2 & GetAbsMousePos() const
get absolute mouse pos (in pixels)
Definition displayevent.h:228
Input::Char GetChar() const
get character code
Definition displayevent.h:255
Input::Key::Code keyCode
Definition displayevent.h:88
Math::vec2 absMousePos
Definition displayevent.h:86
const Math::vec2 & GetNormMousePos() const
get normalized mouse pos (from 0.0 to 1.0)
Definition displayevent.h:237
Code
event codes
Definition displayevent.h:28
@ Character
Definition displayevent.h:44
@ WindowMinimized
Definition displayevent.h:34
@ WindowClose
Definition displayevent.h:31
@ WindowReopen
Definition displayevent.h:32
@ WindowResized
Definition displayevent.h:37
@ MouseButtonDown
Definition displayevent.h:46
@ WindowOpen
Definition displayevent.h:30
@ MouseButtonUp
Definition displayevent.h:47
@ InvalidCode
Definition displayevent.h:29
@ KeyUp
Definition displayevent.h:43
@ MouseButtonDoubleClick
Definition displayevent.h:48
@ KeyDown
Definition displayevent.h:42
@ MouseWheelBackward
Definition displayevent.h:50
@ MouseWheelForward
Definition displayevent.h:49
@ SetFocus
Definition displayevent.h:40
@ ToggleFullscreenWindowed
Definition displayevent.h:36
@ SetCursor
Definition displayevent.h:38
@ CloseRequested
Definition displayevent.h:33
@ KillFocus
Definition displayevent.h:41
@ MouseMove
Definition displayevent.h:45
@ WindowRestored
Definition displayevent.h:35
@ Paint
Definition displayevent.h:39
Input::MouseButton::Code mouseButtonCode
Definition displayevent.h:90
Code
key codes
Definition key.h:25
Code
code enums
Definition mousebutton.h:23
Acceleration structures are used to enable ray tracing on the GPU by dividing the scene into a BVH.
Definition accelerationstructure.h:24
This simple Id pool implements a set of free and used consecutive integers.
Definition id.h:135
static constexpr Id32 InvalidId32
Definition id.h:143
FIXME!
unsigned char Char
Definition char.h:16
Definition window.h:25
A 2-component float vector class.
Definition vec2.h:21