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 friend class Window;
24
25 public:
29 ~Mouse() noexcept;
30
36 [[nodiscard]]
37 bool has_mouse() const noexcept;
38
44 void set_mouse_grab(const bool grabbed) const noexcept;
45
54 void warp_mouse(const float x, const float y) const noexcept;
55
59 void show_cursor() const noexcept;
60
64 void hide_cursor() const noexcept;
65
71 void set_cursor_system(const SDL_SystemCursor cursor) noexcept;
72
79 void set_cursor_custom(const std::string& cursor, const glm::ivec2& hotspot) noexcept;
80
84 void restore_cursor() noexcept;
85
86 private:
90 Mouse() noexcept;
91
95 Mouse(Mouse&&) = delete;
96
100 Mouse& operator=(Mouse&&) = delete;
101
105 Mouse(const Mouse&) = delete;
106
110 Mouse& operator=(const Mouse&) = delete;
111
115 void destroy_cursor() noexcept;
116
117 private:
121 SDL_Cursor* m_cursor;
122 };
123} // namespace galaxy
124
125#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:54
~Mouse() noexcept
Destructor.
Definition Mouse.cpp:24
void destroy_cursor() noexcept
Destroy any existing cursor.
Definition Mouse.cpp:113
void hide_cursor() const noexcept
Hide cursor.
Definition Mouse.cpp:49
void restore_cursor() noexcept
Set the cursor back to default.
Definition Mouse.cpp:107
void set_mouse_grab(const bool grabbed) const noexcept
Toggle mouse grab.
Definition Mouse.cpp:34
void show_cursor() const noexcept
Show cursor.
Definition Mouse.cpp:44
SDL_Cursor * m_cursor
Holds data for a custom cursor.
Definition Mouse.hpp:121
bool has_mouse() const noexcept
Check if there is a mouse connected.
Definition Mouse.cpp:29
void set_cursor_custom(const std::string &cursor, const glm::ivec2 &hotspot) noexcept
Set custom cursor texture.
Definition Mouse.cpp:69
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:39
Binds the mouse to the window.
RAII Window. Handles events, input & display.
Definition Window.hpp:33
Animated.cpp galaxy.
Definition Animated.cpp:16
STL namespace.