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
galaxy::Mouse Class Referencefinal

Physical mouse device and state management. More...

#include <Mouse.hpp>

Inheritance diagram for galaxy::Mouse:
Collaboration diagram for galaxy::Mouse:

Public Member Functions

 Mouse () noexcept
 Constructor.
 ~Mouse () noexcept
 Destructor.
bool has_mouse () const noexcept
 Check if there is a mouse connected.
void set_mouse_grab (const bool grabbed) const noexcept
 Toggle mouse grab.
void warp_mouse (const float x, const float y) const noexcept
 Move the mouse cursor to the given position within the window.
void show_cursor () const noexcept
 Show cursor.
void hide_cursor () const noexcept
 Hide cursor.
void set_cursor_system (const SDL_SystemCursor cursor) noexcept
 Set cursor to a system cursor.
void set_cursor_custom (const std::string &cursor, const glm::ivec2 &hotspot) noexcept
 Set custom cursor texture.
void restore_cursor () noexcept
 Set the cursor back to default.
Public Member Functions inherited from galaxy::WindowBindable
virtual ~WindowBindable () noexcept
 Virtual destructor.

Private Member Functions

 Mouse (Mouse &&)=delete
 Move constructor.
Mouseoperator= (Mouse &&)=delete
 Move assignment operator.
 Mouse (const Mouse &)=delete
 Copy constructor.
Mouseoperator= (const Mouse &)=delete
 Copy assignment operator.
void destroy_cursor () noexcept
 Destroy any existing cursor.

Private Attributes

SDL_Cursor * m_cursor
 Holds data for a custom cursor.

Additional Inherited Members

Protected Member Functions inherited from galaxy::WindowBindable
 WindowBindable () noexcept
 Constructor.
 WindowBindable (WindowBindable &&) noexcept
 Move constructor.
virtual WindowBindableoperator= (WindowBindable &&) noexcept
 Move assignment operator.
 WindowBindable (const WindowBindable &) noexcept
 Copy constructor.
virtual WindowBindableoperator= (const WindowBindable &) noexcept
 Copy assignment operator.
void bind_window () noexcept
 Bind SDL3 window to this object.
Protected Attributes inherited from galaxy::WindowBindable
SDL_Window * m_window
 Pointer to SDL_Window handle.

Detailed Description

Physical mouse device and state management.

Definition at line 21 of file Mouse.hpp.

Constructor & Destructor Documentation

◆ Mouse() [1/3]

galaxy::Mouse::Mouse ( )
noexcept

Constructor.

Definition at line 19 of file Mouse.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~Mouse()

galaxy::Mouse::~Mouse ( )
noexcept

Destructor.

Definition at line 25 of file Mouse.cpp.

Here is the call graph for this function:

◆ Mouse() [2/3]

galaxy::Mouse::Mouse ( Mouse && )
privatedelete

Move constructor.

Here is the call graph for this function:

◆ Mouse() [3/3]

galaxy::Mouse::Mouse ( const Mouse & )
privatedelete

Copy constructor.

Here is the call graph for this function:

Member Function Documentation

◆ has_mouse()

bool galaxy::Mouse::has_mouse ( ) const
nodiscardnoexcept

Check if there is a mouse connected.

Returns
True if there is a mouse device connected.

Definition at line 30 of file Mouse.cpp.

Here is the caller graph for this function:

◆ set_mouse_grab()

void galaxy::Mouse::set_mouse_grab ( const bool grabbed) const
noexcept

Toggle mouse grab.

Parameters
grabbedThis is true to grab keyboard, and false to release.

Definition at line 35 of file Mouse.cpp.

Here is the caller graph for this function:

◆ warp_mouse()

void galaxy::Mouse::warp_mouse ( const float x,
const float y ) const
noexcept

Move the mouse cursor to the given position within the window.

This function generates a mouse motion event.

Parameters
xThe x coordinate within the window.
yThe y coordinate within the window.

Definition at line 40 of file Mouse.cpp.

Here is the caller graph for this function:

◆ show_cursor()

void galaxy::Mouse::show_cursor ( ) const
noexcept

Show cursor.

Definition at line 45 of file Mouse.cpp.

Here is the caller graph for this function:

◆ hide_cursor()

void galaxy::Mouse::hide_cursor ( ) const
noexcept

Hide cursor.

Definition at line 50 of file Mouse.cpp.

Here is the caller graph for this function:

◆ set_cursor_system()

void galaxy::Mouse::set_cursor_system ( const SDL_SystemCursor cursor)
noexcept

Set cursor to a system cursor.

Parameters
cursorSDL_SystemCursor enum.

Definition at line 55 of file Mouse.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_cursor_custom()

void galaxy::Mouse::set_cursor_custom ( const std::string & cursor,
const glm::ivec2 & hotspot )
noexcept

Set custom cursor texture.

Parameters
cursorCursor texture in VFS.
hotspotThe position of the cursor hot spot where the click is triggered.

Definition at line 70 of file Mouse.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restore_cursor()

void galaxy::Mouse::restore_cursor ( )
noexcept

Set the cursor back to default.

Definition at line 108 of file Mouse.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

Mouse & galaxy::Mouse::operator= ( Mouse && )
privatedelete

Move assignment operator.

Here is the call graph for this function:

◆ operator=() [2/2]

Mouse & galaxy::Mouse::operator= ( const Mouse & )
privatedelete

Copy assignment operator.

Here is the call graph for this function:

◆ destroy_cursor()

void galaxy::Mouse::destroy_cursor ( )
privatenoexcept

Destroy any existing cursor.

Definition at line 114 of file Mouse.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ m_cursor

SDL_Cursor* galaxy::Mouse::m_cursor
private

Holds data for a custom cursor.

Definition at line 119 of file Mouse.hpp.


The documentation for this class was generated from the following files: