cangine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
cangine::Mouse Class Reference

Singleton tracking mouse state and dispatching mouse events. More...

#include <mouse.hpp>

Collaboration diagram for cangine::Mouse:
Collaboration graph
[legend]

Public Member Functions

Vector2 getCursorPosition ()
 Returns the current cursor position.
 
 Mouse ()
 Constructs the mouse tracker.
 

Static Public Member Functions

static Mouse * getInstance ()
 Returns the singleton instance.
 

Private Member Functions

void _mouseClickHandler (GLFWwindow *window, int button, int action, int mods)
 Handles a raw GLFW mouse button callback.
 
void _mouseEnterHandler (GLFWwindow *window, int entered)
 Handles a raw GLFW cursor enter/leave callback.
 
void _cursorMoveHandler (GLFWwindow *window)
 Handles a raw GLFW cursor move callback.
 
void _scrollWheelInputHandler (GLFWwindow *window, Vector2 offset)
 Handles a raw GLFW scroll callback.
 
void _fireEvent (const MouseEvent *event)
 Dispatches a mouse event to listeners.
 

Private Attributes

Vector2 cursorPos
 

Static Private Attributes

static Mouse * instance = nullptr
 Singleton instance.
 

Friends

class Window
 

Detailed Description

Singleton tracking mouse state and dispatching mouse events.

Receives raw GLFW callbacks via Window and exposes the current cursor position.

Constructor & Destructor Documentation

◆ Mouse()

cangine::Mouse::Mouse ( )

Constructs the mouse tracker.

Member Function Documentation

◆ _cursorMoveHandler()

void cangine::Mouse::_cursorMoveHandler ( GLFWwindow *  window)
private

Handles a raw GLFW cursor move callback.

◆ _fireEvent()

void cangine::Mouse::_fireEvent ( const MouseEvent *  event)
private

Dispatches a mouse event to listeners.

◆ _mouseClickHandler()

void cangine::Mouse::_mouseClickHandler ( GLFWwindow *  window,
int  button,
int  action,
int  mods 
)
private

Handles a raw GLFW mouse button callback.

◆ _mouseEnterHandler()

void cangine::Mouse::_mouseEnterHandler ( GLFWwindow *  window,
int  entered 
)
private

Handles a raw GLFW cursor enter/leave callback.

◆ _scrollWheelInputHandler()

void cangine::Mouse::_scrollWheelInputHandler ( GLFWwindow *  window,
Vector2  offset 
)
private

Handles a raw GLFW scroll callback.

◆ getCursorPosition()

Vector2 cangine::Mouse::getCursorPosition ( )

Returns the current cursor position.

Returns
Cursor position in window coordinates.

◆ getInstance()

Mouse * cangine::Mouse::getInstance ( )
static

Returns the singleton instance.

Returns
Pointer to the Mouse instance.

Friends And Related Symbol Documentation

◆ Window

friend class Window
friend

Member Data Documentation

◆ cursorPos

Vector2 cangine::Mouse::cursorPos
private

Last known cursor position.

◆ instance

Mouse * cangine::Mouse::instance = nullptr
staticprivate

Singleton instance.


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