FifeGUI 0.2.0
A C++ GUI library designed for games.
mouseinput.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_MOUSEINPUT_HPP_
6#define INCLUDE_FIFECHAN_MOUSEINPUT_HPP_
7
8#include <cstdint>
9
10#include "fifechan/platform.hpp"
11
12namespace fcn
13{
14
23 class FIFEGUI_API MouseInput
24 {
25 public:
26 MouseInput() = default;
27
29 enum class Type : std::uint8_t
30 {
31 Moved = 0,
32 Pressed,
33 Released,
34 WheelMovedDown,
35 WheelMovedUp,
36 WheelMovedRight,
37 WheelMovedLeft
38 };
39
41 enum class Button : std::uint8_t
42 {
43 Empty = 0,
44 Left,
45 Right,
46 Middle,
47 X1,
48 X2
49 };
50
61 MouseInput(Button button, Type type, int x, int y, int timeStamp);
62
69 void setType(Type type);
70
77 Type getType() const;
78
85 void setButton(Button button);
86
93 Button getButton() const;
94
102 void setTimeStamp(int timeStamp);
103
111 int getTimeStamp() const;
112
119 void setX(int x);
120
127 int getX() const;
128
135 void setY(int y);
136
143 int getY() const;
144
145 protected:
149 Type mType{Type::Moved};
150
154 Button mButton{Button::Empty};
155
161
165 int mX{0};
166
170 int mY{0};
171 };
172} // namespace fcn
173
174#endif // INCLUDE_FIFECHAN_MOUSEINPUT_HPP_
A standard clickable button widget.
Definition button.hpp:38
Internal class representing raw mouse input data.
Button mButton
Holds the button of the mouse input.
int mX
Holds the x coordinate of the mouse input.
int mTimeStamp
Holds the timestamp of the mouse input.
Button
Mouse button.
int mY
Holds the y coordinate of the mouse input.
Type mType
Holds the type of the mouse input.
Type
Type of mouse input.