Capycore Engine  0.1.0
A simple and lightweight game engine written in C++ based on the Unity API architecture.
Loading...
Searching...
No Matches
mouse_state.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <map>
7
14enum class MouseDirection : std::uint8_t {
15 none,
16 up,
17 down,
18 left,
19 right
20};
21
29 bool current = false;
30 bool previous =
31 false;
32
33 void reset();
34};
35
43 float x_scroll = 0.0f;
44 float y_scroll = 0.0f;
45
46 float x_delta = 0.0f;
47 float y_delta = 0.0f;
48
50
51 void reset();
52};
53
61struct MouseState {
62 // Cursor position in window coordinates.
64
65 // Cursor movement delta since last frame.
66 float delta_x = 0.0f;
67 float delta_y = 0.0f;
68
69 std::map<MouseButton, MouseButtonState> buttons;
71
72 void reset();
73};
Represents a point in 2D space.
Definition point.h:6
MouseDirection
Represents the primary directions of mouse wheel movement.
Definition mouse_state.h:14
@ none
No scroll detected (this frame).
@ up
Scroll wheel moved upward (away from the user).
@ down
Scroll wheel moved downward (toward the user).
@ right
Scroll wheel moved rightward.
@ left
Scroll wheel moved leftward.
Represents per-frame mouse button transition state.
Definition mouse_state.h:28
bool previous
True if the button was down in the previous frame.
Definition mouse_state.h:30
bool current
True if the button is down this frame.
Definition mouse_state.h:29
Aggregates all mouse-related state information.
Definition mouse_state.h:61
float delta_y
Definition mouse_state.h:67
std::map< MouseButton, MouseButtonState > buttons
Definition mouse_state.h:69
Point position
Definition mouse_state.h:63
void reset()
MouseWheelState wheel
Definition mouse_state.h:70
float delta_x
Definition mouse_state.h:66
Represents per-frame scroll state of the mouse wheel.
Definition mouse_state.h:42
float x_scroll
Accumulated horizontal scroll position.
Definition mouse_state.h:43
float x_delta
Horizontal scroll change this frame.
Definition mouse_state.h:46
float y_scroll
Accumulated vertical scroll position.
Definition mouse_state.h:44
float y_delta
Vertical scroll change this frame.
Definition mouse_state.h:47
MouseDirection last_scroll_direction
Definition mouse_state.h:49