40 #ifndef _inputcontroller_cpp
41 #define _inputcontroller_cpp
43 #include "Input/controller.h"
55 SDL_Joystick* InternalController = (SDL_Joystick*)InternalControl;
56 this->
Axes.resize( SDL_JoystickNumAxes(InternalController), 0 );
57 this->
Trackballs.resize( SDL_JoystickNumBalls(InternalController),
Vector2(0,0) );
59 this->
Hats.resize( SDL_JoystickNumHats(InternalController), Input::CONTROLLERHAT_CENTERED );
61 this->
DeviceName = SDL_JoystickName(InternalController);
71 for(
Whole X = 0 ; X < DeltaCodes.size() ; ++X )
73 const MetaCode& CurrCode = DeltaCodes[X];
78 else if(CurrCode.
GetCode() >= Input::CONTROLLERBALL_FIRST && CurrCode.
GetCode() <= Input::CONTROLLERBALL_LAST)
80 if( Input::CONTROLLERBALL_1_HORIZONTAL == CurrCode.
GetCode() ){
82 }
else if( Input::CONTROLLERBALL_1_VERTICAL == CurrCode.
GetCode() ){
84 }
else if( Input::CONTROLLERBALL_2_HORIZONTAL == CurrCode.
GetCode() ){
86 }
else if( Input::CONTROLLERBALL_2_VERTICAL == CurrCode.
GetCode() ){
95 else if(CurrCode.
GetCode() >= Input::CONTROLLERHAT_FIRST && CurrCode.
GetCode() <= Input::CONTROLLERHAT_LAST)
97 this->
Hats.at( CurrCode.
GetCode() - Input::CONTROLLERHAT_FIRST ) = static_cast<Input::HatState>(CurrCode.
GetMetaValue());
107 if( !MCIt->IsControllerEvent() )
125 {
return this->
Index; }
131 {
return this->
Axes.size(); }
137 {
return this->
Hats.size(); }
143 {
return this->
Axes.at( Axis - 1 ); }
146 {
return this->
Trackballs.at( Trackball - 1 ); }
155 {
return this->
Hats.at( Hat - 1 ); }
162 if( Input::CONTROLLERBALL_1_HORIZONTAL == Trackball ){
164 }
else if( Input::CONTROLLERBALL_1_VERTICAL == Trackball ){
166 }
else if( Input::CONTROLLERBALL_2_HORIZONTAL == Trackball ){
168 }
else if( Input::CONTROLLERBALL_2_VERTICAL == Trackball ){
176 {
return this->
Buttons.at( Button - 1 ); }
182 {
return this->
Hats.at( Hat - Input::CONTROLLERHAT_FIRST ); }
bool Boole
Generally acts a single bit, true or false.
#define MEZZ_EXCEPTION(num, desc)
An easy way to throw exceptions with rich information.
This implements the exception hiearchy for Mezzanine.
float Real
A Datatype used to represent a real floating point number.
uint16_t UInt16
An 16-bit unsigned integer.
Real Y
Coordinate on the Y vector.
Real X
Coordinate on the X vector.
uint32_t UInt32
An 32-bit unsigned integer.
This is used to represent a point on a 2 dimentional area, such as a screen.
int16_t Int16
An 16-bit integer.
Thrown when parameters are checked at runtime and found invalid.
Input::MetaCode::ConstMetaCodeIterator ConstMetaCodeIterator
Const Iterator type for convenient MetaCode storage.
Input::MetaCode::MetaCodeContainer MetaCodeContainer
Convenience datatype for storage of MetaCodes.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
std::string String
A datatype used to a series of characters.