SaturnRingLibrary 0.6
SGL wrapper
 
Loading...
Searching...
No Matches
SRL::Input::Pointer Struct Reference

Detailed Description

Generic pointing (mouse) peripheral.

#include <srl_input.hpp>

Inheritance diagram for SRL::Input::Pointer:
SRL::Input::PeripheralGeneric

Public Types

enum  Button { Left = 1 << 10 , Right = 1 << 9 , Middle = 1 << 8 , Start = 1 << 11 }
 Pointer device buttons. More...
 

Public Member Functions

 Pointer (const uint8_t &port)
 Construct a new pointing peripheral handler.
 
PeripheralFamily GetFamily ()
 Gets connected peripheral type family.
 
virtual SRL::Types::Vector2D GetPosition ()
 Get the pointer position.
 
PeripheralType GetType ()
 Gets connected peripheral type.
 
bool IsConnected () override
 Indicates whether peripheral is connected or not.
 
virtual bool IsHeld (const Button &button)
 Check if user is holding down a button.
 
virtual bool WasPressed (const Button &button)
 Check if user pressed a button.
 
virtual bool WasReleased (const Button &button)
 Check if user released a button.
 

Public Attributes

uint8_t Port = 0
 Port number peripheral is connected to.
 

Protected Member Functions

PerDigital * GetCurrentFrameState ()
 Get state of the peripheral in the current frame.
 
PerDigital * GetPreviousFrameState ()
 Get state of the peripheral in the previous frame.
 

Member Enumeration Documentation

◆ Button

Pointer device buttons.

Enumerator
Left 

Left pointer button.

Right 

Right pointer button.

Middle 

Middle pointer button.

Start 

Start button.

Constructor & Destructor Documentation

◆ Pointer()

SRL::Input::Pointer::Pointer ( const uint8_t & port)
inline

Construct a new pointing peripheral handler.

Parameters
portPointing peripheral port

Member Function Documentation

◆ GetCurrentFrameState()

PerDigital * SRL::Input::PeripheralGeneric::GetCurrentFrameState ( )
inlineprotectedinherited

Get state of the peripheral in the current frame.

Returns
PerDigital* Peripheral data

◆ GetFamily()

PeripheralFamily SRL::Input::PeripheralGeneric::GetFamily ( )
inlineinherited

Gets connected peripheral type family.

Returns
Peripheral type family

◆ GetPosition()

virtual SRL::Types::Vector2D SRL::Input::Pointer::GetPosition ( )
inlinevirtual

Get the pointer position.

Returns
Vector2D Pointer position

◆ GetPreviousFrameState()

PerDigital * SRL::Input::PeripheralGeneric::GetPreviousFrameState ( )
inlineprotectedinherited

Get state of the peripheral in the previous frame.

Returns
PerDigital* Peripheral data

◆ GetType()

PeripheralType SRL::Input::PeripheralGeneric::GetType ( )
inlineinherited

Gets connected peripheral type.

Returns
Peripheral type

◆ IsConnected()

bool SRL::Input::Pointer::IsConnected ( )
inlineoverridevirtual

Indicates whether peripheral is connected or not.

Returns
true if connected

Reimplemented from SRL::Input::PeripheralGeneric.

◆ IsHeld()

virtual bool SRL::Input::Pointer::IsHeld ( const Button & button)
inlinevirtual

Check if user is holding down a button.

Parameters
buttonButton to check
Returns
true Button was pressed
false Button was not pressed

◆ WasPressed()

virtual bool SRL::Input::Pointer::WasPressed ( const Button & button)
inlinevirtual

Check if user pressed a button.

Parameters
buttonButton to check
Returns
true Button was pressed
false Button was not pressed

◆ WasReleased()

virtual bool SRL::Input::Pointer::WasReleased ( const Button & button)
inlinevirtual

Check if user released a button.

Parameters
buttonButton to check
Returns
true Button was released
false Button was not released

Member Data Documentation

◆ Port

uint8_t SRL::Input::PeripheralGeneric::Port = 0
inherited

Port number peripheral is connected to.

Note
valid number is 0 to 11, see SRL::Input::MaxPeripherals