Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Mouse Struct Reference

Captures mouse state at a given instant (buttons, position, wheel). More...

#include <spk_mouse.hpp>

Collaboration diagram for spk::Mouse:
Collaboration graph

Public Types

enum  Button { Right , Middle , Left }
 Mouse buttons tracked by the input system.

Public Member Functions

InputState & operator[] (const Button p_button)
 Accesses the state of a mouse button.
const InputState & operator[] (const Button p_button) const
 Accesses the state of a mouse button.

Public Attributes

std::array< InputState, NbButtonbuttons
 Button states ordered as Right, Middle, Left.
spk::Vector2Int position = {0, 0}
 Current cursor position.
spk::Vector2Int deltaPosition = {0, 0}
 Current delta position between current frame and the previous one.
float wheel = 0
 Wheel delta.

Static Public Attributes

static const size_t NbButton = 3
 Number of mouse buttons supported.

Detailed Description

Captures mouse state at a given instant (buttons, position, wheel).

Member Function Documentation

◆ operator[]() [1/2]

InputState & spk::Mouse::operator[] ( const Button p_button)
inline

Accesses the state of a mouse button.

Parameters
p_buttonButton to query.
Returns
Mutable reference to the button state.

◆ operator[]() [2/2]

const InputState & spk::Mouse::operator[] ( const Button p_button) const
inline

Accesses the state of a mouse button.

Parameters
p_buttonButton to query.
Returns
Const reference to the button state.

The documentation for this struct was generated from the following file: