Generic digital peripheral.
#include <srl_input.hpp>
Public Types | |
enum class | Button : uint16_t { Right = 1 << 15 , Left = 1 << 14 , Down = 1 << 13 , Up = 1 << 12 , START = 1 << 11 , A = 1 << 10 , B = 1 << 8 , C = 1 << 9 , X = 1 << 6 , Y = 1 << 5 , Z = 1 << 4 , R = 1 << 7 , L = 1 << 3 } |
Digital gamepad buttons. More... | |
Public Member Functions | |
Digital (const uint8_t &port) | |
Construct a new Gamepad handler. | |
PeripheralFamily | GetFamily () |
Gets connected peripheral type family. | |
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. | |
|
strong |
Digital gamepad buttons.
|
inline |
Construct a new Gamepad handler.
port | Gamepad peripheral port |
|
inlineprotectedinherited |
Get state of the peripheral in the current frame.
|
inlineinherited |
Gets connected peripheral type family.
|
inlineprotectedinherited |
Get state of the peripheral in the previous frame.
|
inlineinherited |
Gets connected peripheral type.
|
inlineoverridevirtual |
Indicates whether peripheral is connected or not.
Reimplemented from SRL::Input::PeripheralGeneric.
|
inlinevirtual |
Check if user is holding down a button.
button | Button to check |
|
inlinevirtual |
Check if user pressed a button.
button | Button to check |
|
inlinevirtual |
Check if user released a button.
button | Button to check |
|
inherited |
Port number peripheral is connected to.