Brunot
Loading...
Searching...
No Matches
Mouse Class Reference

Class that tracks mouse position and detects whenever a mouse button is pressed. More...

#include <Mouse.h>

Collaboration diagram for Mouse:
[legend]

Public Member Functions

 Mouse ()
auto update (float dt) -> void
auto showMenu () -> void
auto getEnabled () const -> bool
 Returns if mouse input is currently enabled or not.
auto setEnabled (bool newState) -> void
 Sets whether input from the mouse is accepted or not.
auto getInputMap () const -> const std::unordered_map< int, std::string > &
 Returns the map of all the registered mouse buttons and their corresponding event.
auto getMousePosition () const -> std::pair< float, float >
 Gets the mouse position in GLFW space (top left is 0,0).
auto getMouseWorldCoords () const -> const Vector4D &
 Gets the mouse position in the world of the gameplay viewport (center is 0,0).

Static Public Member Functions

static auto mouseButtonCallback (GLFWwindow *window, int pressedButton, int action, int mods) -> void
 Callback used by GLFW whenever a button on the mouse is pressed/released. Broadcasts a message on press.
static constexpr auto getMouseDeviceID () -> int
 Used to keep our use of the Mouse input device ID consistent.

Private Attributes

bool enabled = true
Vector4D mouseWorldCoords = {0.f, 0.f, 0.f, 1.f}
std::unordered_map< int, std::string > mouseButtonMap
 A map that takes GLFW mouse codes and maps them to input event names.

Static Private Attributes

static const Vector4D outOfBoundsPosition
static constexpr auto mouseDeviceID = -2
 ID representing all mouse input done.

Detailed Description

Class that tracks mouse position and detects whenever a mouse button is pressed.

@Mouse.h

Constructor & Destructor Documentation

◆ Mouse()

Mouse::Mouse ( )
Here is the call graph for this function:

Member Function Documentation

◆ getEnabled()

auto Mouse::getEnabled ( ) const->bool

Returns if mouse input is currently enabled or not.

◆ getInputMap()

auto Mouse::getInputMap ( ) const->conststd::unordered_map< int, std::string > &

Returns the map of all the registered mouse buttons and their corresponding event.

◆ getMouseDeviceID()

constexpr auto Mouse::getMouseDeviceID ( ) ->int
inlinestaticconstexpr

Used to keep our use of the Mouse input device ID consistent.

Here is the caller graph for this function:

◆ getMousePosition()

auto Mouse::getMousePosition ( ) const->std::pair< float, float >

Gets the mouse position in GLFW space (top left is 0,0).

This does not take into account where the window is in editor

Here is the call graph for this function:

◆ getMouseWorldCoords()

auto Mouse::getMouseWorldCoords ( ) const->constVector4D &

Gets the mouse position in the world of the gameplay viewport (center is 0,0).

Here is the call graph for this function:

◆ mouseButtonCallback()

auto Mouse::mouseButtonCallback ( GLFWwindow * window,
int pressedButton,
int action,
int mods )->void
static

Callback used by GLFW whenever a button on the mouse is pressed/released. Broadcasts a message on press.

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

◆ setEnabled()

auto Mouse::setEnabled ( bool newState) ->void

Sets whether input from the mouse is accepted or not.

◆ showMenu()

auto Mouse::showMenu ( ) ->void
Here is the call graph for this function:

◆ update()

auto Mouse::update ( float dt) ->void
Here is the call graph for this function:

Member Data Documentation

◆ enabled

bool Mouse::enabled = true
private

◆ mouseButtonMap

std::unordered_map<int, std::string> Mouse::mouseButtonMap
private

A map that takes GLFW mouse codes and maps them to input event names.

◆ mouseDeviceID

auto Mouse::mouseDeviceID = -2
staticconstexprprivate

ID representing all mouse input done.

◆ mouseWorldCoords

Vector4D Mouse::mouseWorldCoords = {0.f, 0.f, 0.f, 1.f}
private

◆ outOfBoundsPosition

const Vector4D Mouse::outOfBoundsPosition
staticprivate

The documentation for this class was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/Framework/Mouse.h
  • /home/egrazil/sites/Brunot/The House/source/Framework/Mouse.cpp