ECSTASY
All in the name
Loading...
Searching...
No Matches
ecstasy::integration::event::Gamepads Class Reference

Current Gamepads states. More...

#include <Gamepads.hpp>

Inheritance diagram for ecstasy::integration::event::Gamepads:
Collaboration diagram for ecstasy::integration::event::Gamepads:

Public Member Functions

 Gamepads () noexcept
 Construct a new Gamepads Resource.
 
 ~Gamepads () noexcept=default
 Default destructor.
 
Gamepadget (std::size_t i)
 Fetch a gamepad.
 
const Gamepadget (std::size_t i) const
 Fetch a gamepad.
 
- Public Member Functions inherited from ecstasy::IResource
virtual ~IResource ()=default
 Default destructor.
 

Static Public Attributes

static const size_t GamepadCount = 4
 Number of supported gamepads.
 

Private Attributes

std::array< Gamepad, GamepadCount_gamepads
 Array of gamepads.
 

Detailed Description

Current Gamepads states.

Hold informations about all the gamepads.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-18)

Definition at line 26 of file Gamepads.hpp.

Constructor & Destructor Documentation

◆ Gamepads()

ecstasy::integration::event::Gamepads::Gamepads ( )
inlinenoexcept

Construct a new Gamepads Resource.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-18)

Definition at line 37 of file Gamepads.hpp.

38 {
39 for (size_t i = 0; i < GamepadCount; i++)
40 _gamepads[i] = Gamepad(i);
41 }
static const size_t GamepadCount
Number of supported gamepads.
Definition Gamepads.hpp:29
std::array< Gamepad, GamepadCount > _gamepads
Array of gamepads.
Definition Gamepads.hpp:91

◆ ~Gamepads()

ecstasy::integration::event::Gamepads::~Gamepads ( )
defaultnoexcept

Default destructor.

Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-18)

Member Function Documentation

◆ get() [1/2]

Gamepad & ecstasy::integration::event::Gamepads::get ( std::size_t  i)
inline

Fetch a gamepad.

Warning
This function doesn't perform bounds check.
Parameters
[in]iId of the gamepad to fetch, must be lower than N.
Returns
Gamepad& A reference to the gamepad at the id i.
Exceptions
std::out_of_rangeIf the id is out of bounds (ie > GamepadCount).
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-18)

Definition at line 65 of file Gamepads.hpp.

66 {
67 return _gamepads[i];
68 }

◆ get() [2/2]

const Gamepad & ecstasy::integration::event::Gamepads::get ( std::size_t  i) const
inline

Fetch a gamepad.

Warning
This function doesn't perform bounds check.
Parameters
[in]iId of the gamepad to fetch, must be lower than N.
Returns
Gamepad& A const reference to the gamepad at the id i.
Exceptions
std::out_of_rangeIf the id is out of bounds (ie > GamepadCount).
Author
Andréas Leroux (andre.nosp@m.as.l.nosp@m.eroux.nosp@m.@epi.nosp@m.tech..nosp@m.eu)
Since
1.0.0 (2022-11-18)

Definition at line 84 of file Gamepads.hpp.

85 {
86 return _gamepads[i];
87 }

Member Data Documentation

◆ _gamepads

std::array<Gamepad, GamepadCount> ecstasy::integration::event::Gamepads::_gamepads
private

Array of gamepads.

Definition at line 91 of file Gamepads.hpp.

◆ GamepadCount

const size_t ecstasy::integration::event::Gamepads::GamepadCount = 4
static

Number of supported gamepads.

Definition at line 29 of file Gamepads.hpp.


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