MezzanineEngine 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Input::Controller Class Reference

This class represents a controller input device, such as a gamepad or joystick. More...

#include <controller.h>

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

Public Member Functions

 Controller (void *InternalControl, int Count)
 Class constructor. More...
 
virtual ~Controller ()
 Class destructor.
 
Int16 GetAxis (const UInt16 Axis) const
 This Gets the value of the given joystick axis. More...
 
Int16 GetAxis (const Input::InputCode &Axis) const
 This Gets the value of the given joystick axis. More...
 
virtual const Input::ButtonStateGetButtonState (const UInt16 Button) const
 Gets the state of the requested button. More...
 
virtual const Input::ButtonStateGetButtonState (const Input::InputCode &Button) const
 Gets the state of the requested button. More...
 
UInt16 GetDeviceIndex () const
 Gets the device index of this controller. More...
 
const StringGetDeviceName () const
 Gets the name of this device. More...
 
const Input::HatStateGetHatState (const UInt16 Hat) const
 Gets the current state of the requested hat. More...
 
const Input::HatStateGetHatState (const Input::InputCode &Hat) const
 Gets the current state of the requested hat. More...
 
UInt16 GetNumAxes () const
 Gets the number of Axes on this device. More...
 
UInt16 GetNumHats () const
 Gets the number of Hats on this device. More...
 
UInt16 GetNumTrackballs () const
 Gets the number of Trackballs on this device. More...
 
Vector2 GetTrackballDelta (const UInt16 Trackball) const
 Gets the delta movement on the requested trackball. More...
 
Real GetTrackballDelta (const Input::InputCode &Trackball) const
 Gets the delta movement on the requested trackball. More...
 
Real GetTrackballDeltaX (const UInt16 Trackball) const
 Gets the delta movement on the X axis on the requested trackball. More...
 
Real GetTrackballDeltaY (const UInt16 Trackball) const
 Gets the delta movement on the Y axis on the requested trackball. More...
 
bool IsHatPushedInDirection (const UInt16 Hat, const Input::HatState &WhichWay) const
 Gets whether a specific hat is pressed in a specific direction. More...
 
- Public Member Functions inherited from Mezzanine::Input::ButtonDevice
 ButtonDevice ()
 Class constructor.
 
virtual ~ButtonDevice ()
 Class destructor.
 
void _Update (const MetaCodeContainer &DeltaCodes, MetaCodeContainer &GeneratedCodes)
 Updates this device with the newest data. More...
 
bool CheckButtonState (const UInt16 Button, const Input::ButtonState &State) const
 Checks to see if a button on this device is a specific state. More...
 
bool CheckButtonState (const Input::InputCode &Button, const Input::ButtonState &State) const
 Checks to see if a button on this device is a specific state. More...
 
UInt16 GetNumButtons () const
 Gets the number of buttons on this device. More...
 
bool IsButtonLifting (const UInt16 Button) const
 Gets whether or not a device button was lifted this frame. More...
 
bool IsButtonLifting (const Input::InputCode &Button) const
 Gets whether or not a device button was lifted this frame. More...
 
bool IsButtonPressed (const UInt16 Button) const
 Gets whether or not a device button is pressed down. More...
 
bool IsButtonPressed (const Input::InputCode &Button) const
 Gets whether or not a device button is pressed down. More...
 
bool IsButtonPressing (const UInt16 Button) const
 Gets whether or not a device button was pressed this frame. More...
 
bool IsButtonPressing (const Input::InputCode &Button) const
 Gets whether or not a device button was pressed this frame. More...
 
bool IsButtonTransitioning (const UInt16 Button) const
 Gets whether or not a device button was lifted or pressed this frame. More...
 
bool 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...
 
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...
 
bool 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
 
void UpdateImpl (const MetaCodeContainer &DeltaCodes, MetaCodeContainer &GeneratedCodes)
 Internal implementation of the device update. More...
 
virtual void VerifySequenceImpl (const MetaCodeContainer &Sequence) const
 
- Protected Member Functions inherited from Mezzanine::Input::ButtonDevice
void UpdateButtonTransitions ()
 Updates transitioning buttons. More...
 

Protected Attributes

std::vector< Int16Axes
 
String DeviceName
 
std::vector< Input::HatStateHats
 
UInt16 Index
 
std::vector< Vector2Trackballs
 
- Protected Attributes inherited from Mezzanine::Input::ButtonDevice
std::vector< Input::ButtonStateButtons
 
std::vector< WholeTransitioningIndexes
 
- Protected Attributes inherited from Mezzanine::Input::Device
SequenceContainer Sequences
 

Detailed Description

This class represents a controller input device, such as a gamepad or joystick.

Definition at line 57 of file controller.h.

Constructor & Destructor Documentation

Mezzanine::Input::Controller::Controller ( void *  InternalControl,
int  Count 
)

Class constructor.

Parameters
InternalControlA pointer to the internal struct of this controller.
Remarks
A void pointer is necessary because SDL forward declares it's own struct already and this won't compile with two forward declares.

Definition at line 53 of file controller.cpp.

Member Function Documentation

void Mezzanine::Input::Controller::AddPressedButtons ( MetaCodeContainer &  GeneratedCodes) const
protectedvirtual

Implements Mezzanine::Input::ButtonDevice.

Definition at line 112 of file controller.cpp.

Int16 Mezzanine::Input::Controller::GetAxis ( const UInt16  Axis) const

This Gets the value of the given joystick axis.

Parameters
AxisThe axis that you want. This value is expected to be 1-20.
Returns
An integer with the Value of the joystick axis.

Definition at line 142 of file controller.cpp.

Int16 Mezzanine::Input::Controller::GetAxis ( const Input::InputCode Axis) const

This Gets the value of the given joystick axis.

Parameters
AxisAn InputCode representing the axis that you want.
Returns
An integer with the Value of the joystick axis.

Definition at line 157 of file controller.cpp.

const Input::ButtonState & Mezzanine::Input::Controller::GetButtonState ( const UInt16  Button) const
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.

Implements Mezzanine::Input::ButtonDevice.

Definition at line 175 of file controller.cpp.

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

Gets the state of the requested button.

Returns
Returns the actual state of the requested button.

Implements Mezzanine::Input::ButtonDevice.

Definition at line 178 of file controller.cpp.

UInt16 Mezzanine::Input::Controller::GetDeviceIndex ( ) const
virtual

Gets the device index of this controller.

Returns
Returns a UInt16 representing the device index for this controller.

Implements Mezzanine::Input::Device.

Definition at line 124 of file controller.cpp.

const String & Mezzanine::Input::Controller::GetDeviceName ( ) const

Gets the name of this device.

Returns
Returns a const string reference containing the name of this device.

Definition at line 127 of file controller.cpp.

const Input::HatState & Mezzanine::Input::Controller::GetHatState ( const UInt16  Hat) const

Gets the current state of the requested hat.

Parameters
HatThe hat to query. This value is expected to be 1-6.
Returns
Returns a HatState representing the current state of the specified hat.

Definition at line 154 of file controller.cpp.

const Input::HatState & Mezzanine::Input::Controller::GetHatState ( const Input::InputCode Hat) const

Gets the current state of the requested hat.

Parameters
HatAn InputCode representing the hat to query.
Returns
Returns a HatState representing the current state of the specified hat.

Definition at line 181 of file controller.cpp.

UInt16 Mezzanine::Input::Controller::GetNumAxes ( ) const

Gets the number of Axes on this device.

Returns
Returns a UInt16 representing the number of Axes present on this controller.

Definition at line 130 of file controller.cpp.

UInt16 Mezzanine::Input::Controller::GetNumHats ( ) const

Gets the number of Hats on this device.

Returns
Returns a UInt16 representing the number of Hats present on this controller.

Definition at line 136 of file controller.cpp.

UInt16 Mezzanine::Input::Controller::GetNumTrackballs ( ) const

Gets the number of Trackballs on this device.

Returns
Returns a UInt16 representing the number of Trackballs present on this controller.

Definition at line 133 of file controller.cpp.

Vector2 Mezzanine::Input::Controller::GetTrackballDelta ( const UInt16  Trackball) const

Gets the delta movement on the requested trackball.

Parameters
TrackballThe trackball to query. This value is expected to be at least 1.
Returns
Returns a vector2 representing the delta movement for the specified trackball.

Definition at line 145 of file controller.cpp.

Real Mezzanine::Input::Controller::GetTrackballDelta ( const Input::InputCode Trackball) const

Gets the delta movement on the requested trackball.

Parameters
TrackballAn InputCode representing the trackball to query.
Returns
Returns a vector2 representing the delta movement for the specified trackball.
Exceptions
AInvalidParametersException is thrown if anything other than a controllerball value from the Input enum is passed.

Definition at line 160 of file controller.cpp.

Real Mezzanine::Input::Controller::GetTrackballDeltaX ( const UInt16  Trackball) const

Gets the delta movement on the X axis on the requested trackball.

Parameters
TrackballThe trackball to query. This value is expected to be at least 1.
Returns
Returns a Real representing the delta movement on the X axis for the specified trackball.

Definition at line 148 of file controller.cpp.

Real Mezzanine::Input::Controller::GetTrackballDeltaY ( const UInt16  Trackball) const

Gets the delta movement on the Y axis on the requested trackball.

Parameters
TrackballThe trackball to query. This value is expected to be at least 1.
Returns
Returns a Real representing the delta movement on the Y axis for the specified trackball.

Definition at line 151 of file controller.cpp.

bool Mezzanine::Input::Controller::IsHatPushedInDirection ( const UInt16  Hat,
const Input::HatState WhichWay 
) const

Gets whether a specific hat is pressed in a specific direction.

Parameters
WhichWayThe hat direction to check for. This value is expected to be 1-6.
Returns
Returns true if the specified hat is pressed in the requested direction.

Definition at line 139 of file controller.cpp.

void Mezzanine::Input::Controller::UpdateImpl ( const MetaCodeContainer &  DeltaCodes,
MetaCodeContainer &  GeneratedCodes 
)
protectedvirtual

Internal implementation of the device update.

Implements Mezzanine::Input::ButtonDevice.

Definition at line 69 of file controller.cpp.

void Mezzanine::Input::Controller::VerifySequenceImpl ( const MetaCodeContainer &  Sequence) const
protectedvirtual

Implements Mezzanine::Input::ButtonDevice.

Definition at line 103 of file controller.cpp.


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