1
0
mirror of https://github.com/borgesdan/xn65 synced 2024-12-29 21:54:47 +01:00
xn65/inc/xna/input/mouse.hpp

59 lines
1.9 KiB
C++
Raw Normal View History

2024-04-16 19:27:05 -03:00
#ifndef XNA_INPUT_MOUSE_HPP
#define XNA_INPUT_MOUSE_HPP
#include "../default.hpp"
namespace xna {
2024-07-31 22:31:08 -03:00
//Represents the state of a mouse input device, including mouse cursor position and buttons pressed.
2024-05-21 20:43:37 -03:00
struct MouseState {
2024-07-31 22:31:08 -03:00
//Returns the state of the left mouse button.
2024-04-17 09:48:48 -03:00
ButtonState LeftButton{ ButtonState::Released };
2024-07-31 22:31:08 -03:00
//Returns the state of the middle mouse button.
2024-04-17 09:48:48 -03:00
ButtonState MiddleButton{ ButtonState::Released };
2024-07-31 22:31:08 -03:00
//Returns the state of the right mouse button.
ButtonState RightButton{ ButtonState::Released };
//Gets the cumulative mouse scroll wheel value since the game was started.
int ScroolWheelValue{ 0 };
//Specifies the horizontal position of the mouse cursor.
int X{ 0 };
//Returns the state of XBUTTON1.
2024-04-17 09:48:48 -03:00
ButtonState XButton1{ ButtonState::Released };
2024-07-31 22:31:08 -03:00
//Returns the state of XBUTTON2.
2024-04-17 09:48:48 -03:00
ButtonState XButton2{ ButtonState::Released };
2024-07-31 22:31:08 -03:00
//Specifies the vertical position of the mouse cursor.
2024-04-16 19:27:05 -03:00
int Y{ 0 };
};
2024-06-22 16:24:11 -03:00
//Allows retrieval of position and button clicks from a mouse input device.
2024-05-21 20:43:37 -03:00
class Mouse {
2024-04-16 19:27:05 -03:00
public:
2024-06-22 16:24:11 -03:00
//Gets the current state of the mouse, including mouse position and buttons pressed.
2024-04-16 19:27:05 -03:00
static MouseState GetState();
2024-06-22 16:24:11 -03:00
2024-07-31 22:31:08 -03:00
//Gets or sets the window used for mouse processing.
//Mouse coordinates returned by GetState are relative to the upper-left corner of this window.
constexpr static intptr_t WindowHandle() {
return windowHandle;
}
//Gets or sets the window used for mouse processing.
//Mouse coordinates returned by GetState are relative to the upper-left corner of this window.
static void WindowHandle(intptr_t value);
2024-05-21 20:43:37 -03:00
2024-06-22 16:24:11 -03:00
private:
friend class Game;
2024-07-31 22:31:08 -03:00
static void Initialize(intptr_t windowHandle);
2024-05-21 20:43:37 -03:00
2024-07-08 09:40:48 -03:00
Mouse() = default;
Mouse(Mouse&) = default;
Mouse(Mouse&&) = default;
2024-07-31 22:31:08 -03:00
inline static intptr_t windowHandle = 0;
2024-05-21 20:43:37 -03:00
public:
struct PlatformImplementation;
2024-06-22 16:24:11 -03:00
inline static uptr<PlatformImplementation> impl = nullptr;
2024-04-16 19:27:05 -03:00
};
}
#endif