#include <sdlinputservice.h>
Classes | |
class | SDLController |
Public Member Functions | |
SDLInputService (ServiceConfiguration *configuration) | |
virtual void | getDependentServices (std::vector< rtti::TypeInfo > &dependencies) override |
virtual bool | init (utility::ErrorState &error) override |
virtual void | shutdown () override |
bool | isConnected (int controllerNumber) const |
bool | controllerInstanceExists (int instance) const |
int | getControllerNumber (int instance) const |
bool | isGameController (int instance) const |
![]() | |
UNPREFIXED_MODULE_NAME_INPUTCASE | Service (ServiceConfiguration *configuration) |
virtual void | update (double deltaTime) override |
Service (ServiceConfiguration *configuration) | |
virtual | ~Service () |
Core & | getCore () |
const Core & | getCore () const |
std::string | getTypeName () const |
const Module & | getModule () const |
Service (Service &)=delete | |
Service & | operator= (const Service &)=delete |
Service (Service &&)=delete | |
Service & | operator= (Service &&)=delete |
Additional Inherited Members | |
![]() | |
virtual void | registerObjectCreators (rtti::Factory &factory) |
virtual void | created () |
virtual void | preUpdate (double deltaTime) |
virtual void | update (double deltaTime) |
virtual void | postUpdate (double deltaTime) |
virtual void | preShutdown () |
virtual void | preResourcesLoaded () |
virtual void | postResourcesLoaded () |
template<typename SERVICE_CONFIG > | |
SERVICE_CONFIG * | getConfiguration () |
template<typename SERVICE_CONFIG > | |
const SERVICE_CONFIG * | getConfiguration () const |
std::string | getIniFilePath () const |
std::string | getIniFilePath (const std::string &appendix) const |
Service that manages connections to external input devices such as a keyboard, mouse, joystick and controller. By default all connections to all available devices are opened automatically, ie: all joysticks, game controllers etc. should be available to the system after initialization. When a controller disconnects it is removed from the system until connected again. This ensures that controllers can be connected / disconnected during sessions.
A Game Controller is a Joystick that makes use of a pre-defined mapping, ie: LeftTrigger etc. Most popular game controllers are supported out of the box such as the xbox live controller etc. If a controller isn't supported natively it is considered to be a Joystick where the user has to interpret the various buttons.
SDLInputService | ( | ServiceConfiguration * | configuration | ) |
bool controllerInstanceExists | ( | int | instance | ) | const |
This call can be used to ensure a controller is known to the system using a unique controller id. The unique controller id is part of SDL controller and joystick events.
int getControllerNumber | ( | int | instance | ) | const |
Returns the physical controller number based on the given unique identifier. This call assumes that a controller with the unique identifier exists!
instance | the unique controller instance, part of an SDL controller / joystick event |
|
overridevirtual |
This service depends on the default input service
dependencies | rtti information of the services this service depends on |
Reimplemented from Service.
|
overridevirtual |
bool isConnected | ( | int | controllerNumber | ) | const |
Checks if a physical controller with the given number is connected. The number is always associated with a physical joystick or game control device
controllerNumber | the number of the controller |
bool isGameController | ( | int | instance | ) | const |
Checks if the controller is a game controller or joystick. Note that this call assumes the instance exists!
instance | the unique controller instance, part of an sdl controller / joystick event |