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
28 enum class Type : std::uint8_t
29 {
30 Moved = 0,
31 Pressed,
32 Released,
33 WheelMovedDown,
34 WheelMovedUp,
35 WheelMovedRight,
36 WheelMovedLeft
37 };
38
39 enum class Button : std::uint8_t
40 {
41 Empty = 0,
42 Left,
43 Right,
44 Middle,
45 X1,
46 X2
47 };
48
59 MouseInput(Button button, Type type, int x, int y, int timeStamp);
60
67 void setType(Type type);
68
75 Type getType() const;
76
83 void setButton(Button button);
84
91 Button getButton() const;
92
100 void setTimeStamp(int timeStamp);
101
109 int getTimeStamp() const;
110
117 void setX(int x);
118
125 int getX() const;
126
133 void setY(int y);
134
141 int getY() const;
142
143 protected:
147 Type mType{Type::Moved};
148
152 Button mButton{Button::Empty};
153
159
163 int mX{0};
164
168 int mY{0};
169 };
170} // namespace fcn
171
172#endif // INCLUDE_FIFECHAN_MOUSEINPUT_HPP_
void setX(int x)
Sets the x coordinate of the mouse input.
Button mButton
Holds the button of the mouse input.
int mX
Holds the x coordinate of the mouse input.
void setTimeStamp(int timeStamp)
Sets the timestamp for the mouse input.
void setY(int y)
Sets the y coordinate of the mouse input.
int mTimeStamp
Holds the timestamp of the mouse input.
int mY
Holds the y coordinate of the mouse input.
Type getType() const
Gets the type of the mouse input.
void setType(Type type)
Sets the type of the mouse input.
Button getButton() const
Gets the button pressed.
int getX() const
Gets the x coordinate of the mouse input.
void setButton(Button button)
Sets the button pressed.
Type mType
Holds the type of the mouse input.
int getY() const
Gets the y coordinate of the mouse input.
int getTimeStamp() const
Gets the time stamp of the input.