galaxy 1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Mouse.hpp
Go to the documentation of this file.
1
7
8#ifndef GALAXY_INPUT_MOUSE_HPP_
9#define GALAXY_INPUT_MOUSE_HPP_
10
11#include <glm/vec2.hpp>
12#include <SDL3/SDL_mouse.h>
13
15
16namespace galaxy
17{
21 class Mouse final : public WindowBindable
22 {
23 public:
27 Mouse() noexcept;
28
32 ~Mouse() noexcept;
33
39 [[nodiscard]]
40 bool has_mouse() const noexcept;
41
47 void set_mouse_grab(const bool grabbed) const noexcept;
48
57 void warp_mouse(const float x, const float y) const noexcept;
58
62 void show_cursor() const noexcept;
63
67 void hide_cursor() const noexcept;
68
74 void set_cursor_system(const SDL_SystemCursor cursor) noexcept;
75
82 void set_cursor_custom(const std::string& cursor, const glm::ivec2& hotspot) noexcept;
83
87 void restore_cursor() noexcept;
88
89 private:
93 Mouse(Mouse&&) = delete;
94
98 Mouse& operator=(Mouse&&) = delete;
99
103 Mouse(const Mouse&) = delete;
104
108 Mouse& operator=(const Mouse&) = delete;
109
113 void destroy_cursor() noexcept;
114
115 private:
119 SDL_Cursor* m_cursor;
120 };
121} // namespace galaxy
122
123#endif
Physical mouse device and state management.
Definition Mouse.hpp:22
void set_cursor_system(const SDL_SystemCursor cursor) noexcept
Set cursor to a system cursor.
Definition Mouse.cpp:55
Mouse() noexcept
Constructor.
Definition Mouse.cpp:19
~Mouse() noexcept
Destructor.
Definition Mouse.cpp:25
Mouse & operator=(Mouse &&)=delete
Move assignment operator.
void destroy_cursor() noexcept
Destroy any existing cursor.
Definition Mouse.cpp:114
void hide_cursor() const noexcept
Hide cursor.
Definition Mouse.cpp:50
Mouse & operator=(const Mouse &)=delete
Copy assignment operator.
Mouse(Mouse &&)=delete
Move constructor.
void restore_cursor() noexcept
Set the cursor back to default.
Definition Mouse.cpp:108
void set_mouse_grab(const bool grabbed) const noexcept
Toggle mouse grab.
Definition Mouse.cpp:35
void show_cursor() const noexcept
Show cursor.
Definition Mouse.cpp:45
SDL_Cursor * m_cursor
Holds data for a custom cursor.
Definition Mouse.hpp:119
bool has_mouse() const noexcept
Check if there is a mouse connected.
Definition Mouse.cpp:30
Mouse(const Mouse &)=delete
Copy constructor.
void set_cursor_custom(const std::string &cursor, const glm::ivec2 &hotspot) noexcept
Set custom cursor texture.
Definition Mouse.cpp:70
void warp_mouse(const float x, const float y) const noexcept
Move the mouse cursor to the given position within the window.
Definition Mouse.cpp:40
Allows you to bind a base class to the window.
Application.hpp galaxy.