Spinning Topp Logo BlackTopp Studios
inc
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Input::ButtonDevice Class Referenceabstract

This is a base class for all input devices with buttons. More...

#include <buttondevice.h>

+ Inheritance diagram for Mezzanine::Input::ButtonDevice:
+ Collaboration diagram for Mezzanine::Input::ButtonDevice:

Public Member Functions

 ButtonDevice ()
 Class constructor.
 
virtual ~ButtonDevice ()
 Class destructor.
 
void _Update (const MetaCodeContainer &DeltaCodes, MetaCodeContainer &GeneratedCodes)
 Updates this device with the newest data. More...
 
Boole CheckButtonState (const UInt16 Button, const Input::ButtonState &State) const
 Checks to see if a button on this device is a specific state. More...
 
Boole CheckButtonState (const Input::InputCode &Button, const Input::ButtonState &State) const
 Checks to see if a button on this device is a specific state. More...
 
virtual const Input::ButtonStateGetButtonState (const UInt16 Button) const =0
 Gets the state of the requested button. More...
 
virtual const Input::ButtonStateGetButtonState (const Input::InputCode &Button) const =0
 Gets the state of the requested button. More...
 
UInt16 GetNumButtons () const
 Gets the number of buttons on this device. More...
 
Boole IsButtonLifting (const UInt16 Button) const
 Gets whether or not a device button was lifted this frame. More...
 
Boole IsButtonLifting (const Input::InputCode &Button) const
 Gets whether or not a device button was lifted this frame. More...
 
Boole IsButtonPressed (const UInt16 Button) const
 Gets whether or not a device button is pressed down. More...
 
Boole IsButtonPressed (const Input::InputCode &Button) const
 Gets whether or not a device button is pressed down. More...
 
Boole IsButtonPressing (const UInt16 Button) const
 Gets whether or not a device button was pressed this frame. More...
 
Boole IsButtonPressing (const Input::InputCode &Button) const
 Gets whether or not a device button was pressed this frame. More...
 
Boole IsButtonTransitioning (const UInt16 Button) const
 Gets whether or not a device button was lifted or pressed this frame. More...
 
Boole IsButtonTransitioning (const Input::ButtonState &Button) const
 Gets whether or not a device button was lifted or pressed this frame. More...
 
- Public Member Functions inherited from Mezzanine::Input::Device
 Device ()
 Class constructor.
 
virtual ~Device ()
 Class destructor.
 
void AddInputSequence (const MetaCodeContainer &Codes, const Int32 &SequenceID)
 Adds a custom sequence of inputs that this system will look for and generate MetaCode's for when they occur.

Exceptions
Ifthe vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown. An exception can also be thrown if the ID provided is the max value of an Int32.
More...
 
virtual UInt16 GetDeviceIndex () const =0
 Gets the device index of this controller. More...
 
Int32 GetIDofInputSequence (const MetaCodeContainer &Codes)
 Gets the ID of the provided sequence of MetaCode's.

Exceptions
Ifthe vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown.
More...
 
Boole InputSequenceExists (const MetaCodeContainer &Codes)
 Checks to see if the provided sequence of MetaCode's is already being checked for.

Exceptions
Ifthe vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown.
More...
 
void RemoveAllInputSequences ()
 Removes all stored input sequences. More...
 
void RemoveInputSequence (const MetaCodeContainer &Codes)
 Removes the specified custom sequence of MetaCode's.

Exceptions
Ifthe vector of MetaCode's doesn't end with a null MetaCode, an exception will be thrown.
More...
 

Protected Member Functions

virtual void AddPressedButtons (MetaCodeContainer &GeneratedCodes) const =0
 Adds MetaCodes belonging to all the buttons that are currently pressed for this device. More...
 
void UpdateButtonTransitions ()
 Updates transitioning buttons. More...
 
virtual void UpdateImpl (const MetaCodeContainer &DeltaCodes, MetaCodeContainer &GeneratedCodes)=0
 Internal implementation of the device update. More...
 
virtual void VerifySequenceImpl (const MetaCodeContainer &Sequence) const =0
 

Protected Attributes

std::vector< Input::ButtonStateButtons
 A container of states for each button on the input device. More...
 
std::vector< WholeTransitioningIndexes
 A container of indexes being tracked due to state transitions. More...
 
- Protected Attributes inherited from Mezzanine::Input::Device
SequenceContainer Sequences
 A container for storing and detecting input sequences for an input device. More...
 

Detailed Description

This is a base class for all input devices with buttons.

Definition at line 53 of file buttondevice.h.

Member Function Documentation

void Mezzanine::Input::ButtonDevice::_Update ( const MetaCodeContainer DeltaCodes,
MetaCodeContainer GeneratedCodes 
)
virtual

Updates this device with the newest data.

Parameters
DeltaCodesA vector of the codes to process and update this device with.
GeneratedCodesA vector to which generated codes (sequence or otherwise) will be added.

Implements Mezzanine::Input::Device.

Definition at line 110 of file buttondevice.cpp.

virtual void Mezzanine::Input::ButtonDevice::AddPressedButtons ( MetaCodeContainer GeneratedCodes) const
protectedpure virtual

Adds MetaCodes belonging to all the buttons that are currently pressed for this device.

Implemented in Mezzanine::Input::Mouse, Mezzanine::Input::Controller, and Mezzanine::Input::Keyboard.

Boole Mezzanine::Input::ButtonDevice::CheckButtonState ( const UInt16  Button,
const Input::ButtonState State 
) const

Checks to see if a button on this device is a specific state.

Parameters
ButtonThe button to check the state of.
StateThe button state to check for.
Returns
Returns true if the requested button is the specified state, false otherwise.

Definition at line 104 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::CheckButtonState ( const Input::InputCode Button,
const Input::ButtonState State 
) const

Checks to see if a button on this device is a specific state.

Parameters
ButtonThe button to check the state of.
StateThe button state to check for.
Returns
Returns true if the requested button is the specified state, false otherwise.

Definition at line 107 of file buttondevice.cpp.

virtual const Input::ButtonState& Mezzanine::Input::ButtonDevice::GetButtonState ( const UInt16  Button) const
pure virtual

Gets the state of the requested button.

Remarks
This function accepts a button number, and as such expects a number from 1 to 20.
Returns
Returns the actual state of the requested button.

Implemented in Mezzanine::Input::Mouse, Mezzanine::Input::Controller, and Mezzanine::Input::Keyboard.

virtual const Input::ButtonState& Mezzanine::Input::ButtonDevice::GetButtonState ( const Input::InputCode Button) const
pure virtual

Gets the state of the requested button.

Returns
Returns the actual state of the requested button.

Implemented in Mezzanine::Input::Mouse, Mezzanine::Input::Controller, and Mezzanine::Input::Keyboard.

UInt16 Mezzanine::Input::ButtonDevice::GetNumButtons ( ) const

Gets the number of buttons on this device.

Returns
Returns a UInt16 representing the number of buttons on this device.

Definition at line 71 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::IsButtonLifting ( const UInt16  Button) const

Gets whether or not a device button was lifted this frame.

Remarks
This function accepts a button number. Check the number of buttons on this device to get the acceptable range. 1 is the minimum value.
Parameters
ButtonThe button to check the state of.
Returns
Returns true if the specified button is being lifted this frame, false otherwise.

Definition at line 86 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::IsButtonLifting ( const Input::InputCode Button) const

Gets whether or not a device button was lifted this frame.

Parameters
ButtonThe button to check the state of.
Returns
Returns true if the specified button is being lifted this frame, false otherwise.

Definition at line 89 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::IsButtonPressed ( const UInt16  Button) const

Gets whether or not a device button is pressed down.

Remarks
This function accepts a button number. Check the number of buttons on this device to get the acceptable range. 1 is the minimum value.
Parameters
ButtonThe button to check the state of.
Returns
Returns whether or not the requested button is pressed down.

Definition at line 74 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::IsButtonPressed ( const Input::InputCode Button) const

Gets whether or not a device button is pressed down.

Parameters
ButtonThe button to check the state of.
Returns
Returns whether or not the requested button is pressed down.

Definition at line 77 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::IsButtonPressing ( const UInt16  Button) const

Gets whether or not a device button was pressed this frame.

Remarks
This function accepts a button number. Check the number of buttons on this device to get the acceptable range. 1 is the minimum value.
Parameters
ButtonThe button to check the state of.
Returns
Returns true if the specified button is being pressed this frame, false otherwise.

Definition at line 80 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::IsButtonPressing ( const Input::InputCode Button) const

Gets whether or not a device button was pressed this frame.

Parameters
ButtonThe button to check the state of.
Returns
Returns true if the specified button is being pressed this frame, false otherwise.

Definition at line 83 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::IsButtonTransitioning ( const UInt16  Button) const

Gets whether or not a device button was lifted or pressed this frame.

Parameters
ButtonThe button to check the state of.
Returns
Returns true if the requested button is pressing or lifting, false otherwise.

Definition at line 92 of file buttondevice.cpp.

Boole Mezzanine::Input::ButtonDevice::IsButtonTransitioning ( const Input::ButtonState Button) const

Gets whether or not a device button was lifted or pressed this frame.

Parameters
ButtonThe button to check the state of.
Returns
Returns true if the requested button is pressing or lifting, false otherwise.

Definition at line 98 of file buttondevice.cpp.

void Mezzanine::Input::ButtonDevice::UpdateButtonTransitions ( )
protected

Updates transitioning buttons.

Definition at line 55 of file buttondevice.cpp.

virtual void Mezzanine::Input::ButtonDevice::UpdateImpl ( const MetaCodeContainer DeltaCodes,
MetaCodeContainer GeneratedCodes 
)
protectedpure virtual

Internal implementation of the device update.

Implemented in Mezzanine::Input::Mouse, Mezzanine::Input::Controller, and Mezzanine::Input::Keyboard.

virtual void Mezzanine::Input::ButtonDevice::VerifySequenceImpl ( const MetaCodeContainer Sequence) const
protectedpure virtual

Member Data Documentation

std::vector<Input::ButtonState> Mezzanine::Input::ButtonDevice::Buttons
protected

A container of states for each button on the input device.

Definition at line 61 of file buttondevice.h.

std::vector<Whole> Mezzanine::Input::ButtonDevice::TransitioningIndexes
protected

A container of indexes being tracked due to state transitions.

Definition at line 58 of file buttondevice.h.


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