Light gun peripheral.
#include <srl_input.hpp>
Public Types | |
enum | Button { Trigger = 1 << 10 , Start = 1 << 11 } |
Pointer device buttons. More... | |
enum | Player { Player1 = 0 , Player2 = 6 } |
Player port. More... | |
Public Member Functions | |
Gun (const Player &player) | |
Construct a new light gun peripheral handler. | |
PeripheralFamily | GetFamily () |
Gets connected peripheral type family. | |
virtual SRL::Types::Vector2D | GetPosition () |
Get the hit 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. | |
Internal function | |
static void | Synchronize () |
Trigger data synchronization. | |
static void | VblankRefresh () |
Refresh light gun trigger and ID data. | |
Pointer device buttons.
Enumerator | |
---|---|
Trigger | Left pointer button. |
Start | Start button. |
|
inline |
Construct a new light gun peripheral handler.
player | Light gun player |
|
inlineprotectedinherited |
Get state of the peripheral in the current frame.
|
inlineinherited |
Gets connected peripheral type family.
|
inlinevirtual |
Get the hit position.
|
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 |
|
inlinestatic |
Trigger data synchronization.
This should be called at the beginning of or at the end of each logic frame
|
inlinestatic |
Refresh light gun trigger and ID data.
This should be called at the beginning of every v-blank
|
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.