![]() |
VR-Forces Development_Version Class Documentation
|
This class will be used to query about current joysticks and the capabilities they might have. More...

Classes | |
| struct | ControllerInformation |
Public Types | |
| typedef boost::unordered_map < int, ControllerInformation > | Controllers |
| typedef std::vector < DtGameControllerEventHandler * > | GameControllerEventHandlers |
| Returns the game controller event handlers. | |
Public Member Functions | |
| DtJoystickManager (DtDe &) | |
| virtual | ~DtJoystickManager () |
| virtual void | flushAllEvents () |
| Flushes all events in the SDL event queue. | |
| virtual ControllerInformation | controllerInformation (int deviceId) const |
| virtual bool | processMouseEvent (const DtMouseEvent &ev, DtChannel &channel) |
| Processes a mouse event on the channel. Currently does not process mouse events. | |
| virtual bool | processKeyboardEvent (const DtKeyEvent &ev, DtChannel &channel) |
| Processes a keyboard event on the channel. | |
| virtual bool | switchControlActive (const std::string &configuration, const std::string &switchGroup) const |
| Returns true if there is a switch between group of the given name with an active controller for this configuration. | |
| virtual DtGenericControllerEvent * | genericEventFromSDLEvent (const SDL_Event &) |
| Converts the SDL event into a given generic event. Do not delete the return pointer as it is reused by this class. | |
| virtual void | removeGameControllerEventHandler (DtGameControllerEventHandler *) |
| Removes the game controller event handler specified. | |
| virtual void | addGameControllerEventHandlerToFront (DtGameControllerEventHandler *) |
| Inserts the game controller event handler at the beginning of the queue. | |
| virtual void | addGameControllerEventHandlerToEnd (DtGameControllerEventHandler *) |
| Adds the game controller event handler to the end of the queue. | |
| virtual void | addJoystickControlFunction (const std::string &functionGroup, const std::string &function, const DtFunctionGroupInformation &) |
| Adds a new function group and function to the available function groups and functions. Signal is emitted when added. | |
| virtual void | addJoystickControlFunction (const std::string &functionGroup, const std::string &function, double minimumValue, double maximumValue, bool cycle=false, const std::string &description="") |
| virtual std::set< std::string > | functionGroupsSimilarTo (const std::string &functionGroup) const |
| Given the function group, return any function group that contains the same type of functions (not necessarily the same function names) as this group. | |
| virtual void | insertGameControllerEventHandlerBefore (DtGameControllerEventHandler *, DtGameControllerEventHandler *) |
| Inserts the game controller handler before the specified handler. If handler does not exist adds to end. | |
| const GameControllerEventHandlers & | gameControllerEventHandlers () const |
| virtual DtUnicode | gameControllerName (const std::string &configuration, const std::string &functionGroup, const std::string &functionCode) const |
| virtual DtUnicode | gameControllerFunction (const std::string &configuration, const std::string &functionGroup, const std::string &functionCode) const |
| virtual std::set< int > | deviceIndexFromControllerInfo (const DtGameControlInformation &) const |
| Returns all the device controllers that can be controlled by this game control information. | |
| virtual int | deviceIndexFromGuid (const std::string &) const |
| virtual int | deviceIndexFromDeviceName (const std::string &) const |
| virtual int | firstDeviceIndexOfConrollerType (int) const |
| std::vector< std::string > | functionsForFunctionGroup (const std::string &) const |
| Returns all the functions in a particular function group. | |
| virtual void | setFavoriteConfiguration (const std::string &) |
| Sets the new favorite configuration. Will emit signal if configuration is different. | |
| virtual const std::string & | favoriteConfiguration () const |
| virtual void | increaseLockCount () |
| Locks the joystick manager from being allowed to accept updates to changing joystick controls. | |
| virtual void | decreaseLockCount () |
| virtual bool | locked () const |
| virtual double | joystickDeadzonePercentage (int) const |
| virtual void | setJoystickDeadzonePercentage (int, double) |
| virtual bool | joystickSettingsForConfiguration (const std::string &, DtJoystickConfigurationSettings &) |
| virtual void | setJoystickSettingsForConfiguration (const std::string &, const DtJoystickConfigurationSettings &) |
| const DtJoystickConfigurations & | joystickConfigurations () |
| virtual std::vector< std::string > | configurations () const |
| virtual void | setFromRecord (const DtJoystickConfigurations &) |
| virtual void | getRecord (DtJoystickConfigurations &) |
| virtual int | numJoystickAxis (int deviceIndex) const |
| Number of axis for a joystick. | |
| virtual int | numJoystickButtons (int deviceIndex) const |
| Number of buttons for a joystick. | |
| virtual int | numJoystickHats (int deviceIndex) const |
| Number of hats for a joystick. | |
| virtual bool | needsTransition (const std::string &functionalGroup, const std::string &function) const |
| Returns true if the given code and group needs a transitional value (i.e the value is just not on or off) If it is non-transitional then only button values are accepted. | |
| virtual bool | toggle (const std::string &functionalGroup, const std::string &function) const |
| Returns true if the given code and group is a toggle value. If it is then only button values are accepted. | |
| virtual bool | cycle (const std::string &functionGroup, const std::string &function) const |
| Returns true if this is a cycle (0, 1, 2, etc) event. | |
| virtual void | getFunctionMinMaxValues (const std::string &functionalGroup, const std::string &function, double &min, double &max) const |
| Supplies the min/max values of the given functionGroup and function. | |
| virtual void | loadDefaults (bool fromFactory=false) |
| Loads default or factory record. | |
| const DtRecordSettingsBackupInterface * | settingsBackup () const |
| DtRecordSettingsBackupInterface * | settingsBackup () |
| virtual Controllers | controllers () const |
| Returns all the controllers currently available to map to. | |
| void | exportSettings (const std::string &fileName) |
| Exports the current cache settings to a file. | |
| void | importSettings (const std::string &fileName) |
| Import the current cache settings from a file. | |
| virtual DtGameControlInformation | gameControlInformationFor (const std::string &configuration, const std::string &functionGroup, const std::string &function) const |
| Returns controller information for the given function group and function or 0 if does not exist. | |
| virtual std::string | descriptionFor (const std::string &functionGroup, const std::string &function) const |
| Returns the description for the given function group and function. | |
| virtual void | removeAllGameControllers () |
| Removes all game controller currently registered. | |
| virtual void | removeGameControlInformationFor (const std::string &configuration, const std::string &functionGroup, const std::string &function) |
| Removes controller information for the given group and function. If removed signal is sent. | |
| virtual void | addGameControlInformationFor (const std::string &configuration, const std::string &functionGroup, const std::string &function, const DtGameControlInformation &) |
| Adds controller information. If information exists it will be replaced with the new information. The given information is cloned. | |
| virtual void | setAutoSave (bool) |
| virtual bool | autoSave () const |
| virtual bool | hasConfigurationName (const std::string &) const |
| Returns true if the configuration name exists. | |
| virtual void | addConfiguration (const std::string &) |
| Adds a new configuration. | |
| virtual void | removeConfiguration (const std::string &) |
| Removes the specified configuration. | |
| virtual bool | functionGroupSpecified (const std::string &configuration, const std::string &functionGroup, bool all=false) const |
| Returns true if at least one function in the function group is specified. If all flag is true then all must be specified. | |
| virtual bool | canFunctionGroupBeAssigned (const std::string &configuration, const std::string &functionGroup, bool all=false) const |
| Returns true if the function group is specified and there is a controller available for it. | |
| virtual void | renameConfiguration (const std::string &old, const std::string &renamed) |
| Renames the configuration. | |
| virtual void | saveAsDefaults () |
| virtual DtJoystickConfigurationSettings::GameControlInformation | gameControlInformation (const std::string &configuration, const std::set< std::string > &) const |
| Returns all the devices used by the given function groups. | |
| virtual DtJoystickConfigurationSettings::GameControlInformation | gameControlInformation (const std::string &configuration, const std::string &) const |
| Note this will return an empty map of function status that can be used to initiate a new function group by controller information. | |
Public Member Functions inherited from makVrv::DtEventProcessorInterface | |
| DtEventProcessorInterface () | |
| CTOR. | |
| virtual | ~DtEventProcessorInterface () |
| DTOR. | |
| virtual bool | processPinchGesture (const DtPinchGesture &ev, DtChannel &channel) |
| Don't require a handler for pinch gestures, but make them available. | |
| virtual void | setEnabled (bool b) |
| Get/set enabled flag. | |
| bool | enabled () const |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| Do nothing constructor. | |
| virtual | ~DtVirtualBaseClass () |
| Virtual do nothing destructor. | |
Static Public Member Functions | |
| static DtJoystickManager & | instance (DtDe &de) |
| static void | registerInstance (DtDe &de, DtJoystickManager *) |
| Register a new joystick manager. | |
Public Attributes | |
| boost::signal< void()> | signal_clear |
| Signal sent when joystick information is cleared. | |
| boost::signal< void(int, int)> | signal_joystickError |
| Signal sent when there is an error with a particular joystick. | |
| boost::signal< void(const ControllerInformation &)> | signal_controllerAdded |
| Signal sent when a joystick is added. | |
| boost::signal< void(int)> | signal_controllerRemoved |
| Signal sent when a joystick is removed (by device index. | |
| boost::signal< void(const DtJoystickConfigurations &)> | signal_configurationsChanged |
| Signal send when joystick settings have changed. | |
| boost::signal< void(const std::string &, const DtJoystickConfigurationSettings &)> | signal_settingsChanged |
| boost::signal< void(const std::string &, const std::string &)> | signal_controllerInformationRemoved |
| Signal sent when controller information is removed for the function group and function. | |
| boost::signal< void(const DtJoystickConfigurationSetting &)> | signal_controllerInformationAdded |
| Signal sent when controller information is added. | |
| boost::signal< void(const std::string &functionGroup, const std::string &function, const DtFunctionGroupInformation &)> | signal_addedJoystickControlFunction |
| Signal sent when a joystick control function is added. | |
| boost::signal< void(int, DtGenericControllerEvent *)> | signal_gameControllerEvent |
| Signal sent when a controller has an event. | |
| boost::signal< void(const std::string &)> | signal_configurationAdded |
| Signal sent when a new configuration is added. | |
| boost::signal< void(const std::string &)> | signal_configurationRemoved |
| Signal sent when a configuration is removed. | |
| boost::signal< void(const std::string &old, const std::string &renamed)> | signal_configurationRenamed |
| Signal sent when a configuration is renamed. | |
| boost::signal< void(bool)> | signal_joystickManagerLockedForUpdates |
| Signal sent when lock state changes. | |
| boost::signal< void(const std::string &, const std::string &)> | signal_favoriteConfigurationChanged |
| Signal sent when the favorite configuration has changed. Will send old/new favorite. | |
Protected Types | |
| typedef std::map< int, DtJoystickDevice > | Joysticks |
| typedef std::map< int, double > | JoystickDeadzonePercent |
| Default deadzone percent by joystick device. Default is 2%. | |
| typedef std::vector < DtGenericControllerEvent * > | JoystickEventQueue |
Protected Member Functions | |
| virtual int | sdlEventFilter (SDL_Event *event) |
| virtual const std::string & | className () |
| Returns the name of the processor class, to be used for identifying an event processor. | |
| void | initialize () |
| Initialize to retrieve joysticks currently attached. Called from constructor. | |
| virtual void | sendNoQueuedEvents () |
| If we had sent an event, tell all controllers that no new events are queued. | |
| virtual void | tick () |
| Poll event queue to see if a joystick has been added or removed. | |
| virtual void | initializeJoysticks () |
| Initializes current joysticks and puts them into internal structures. | |
| virtual void | initializeGameControllers () |
| Initializes current gamecontrollers and puts them into internal structures. | |
| virtual void | initializeKeyboard () |
| Initializes any related keyboard information. Currently only one keyboard supported. | |
| virtual void | addJoystickDevice (int deviceId) |
| Adds a new joystick device to the system based on SDL information. Emits a signal for joystick added. | |
| virtual void | removeJoystickDevice (int deviceId) |
| Removed the joystick. Emits the signal for joystick removed. | |
| virtual bool | processControllerEvent (DtGenericControllerEvent *) |
| Processes the controller event. | |
Static Protected Member Functions | |
| static int | sdlEventFilterCallback (void *userdata, SDL_Event *event) |
Protected Attributes | |
| DtDe & | myDe |
| Joysticks | myJoysticks |
| DtSignalConnectionManager | myConnections |
| DtJoystickConfigurations | myJoystickConfigurations |
| DtRecordSettingsBackupInterface * | mySettingsBackup |
| GameControllerEventHandlers | myGameControllerEventHandlers |
| int | myLockCount |
| DtGameControllerJoystickEvent * | myJoystickControllerEvent |
| Used for event filtering so do not have to create on stack every time. | |
| DtGameControllerKeyboardEvent * | myKeyboardControllerEvent |
| bool | myAmEventProcessor |
| bool | mySentEvent |
| JoystickDeadzonePercent | myJoystickDeadzonePercent |
| ControllerInformation | myKeyboardInformation |
| JoystickEventQueue | myJoystickEventQueue |
Protected Attributes inherited from makVrv::DtEventProcessorInterface | |
| bool | myEnabled |
This class will be used to query about current joysticks and the capabilities they might have.
It will also manage settings for those joysticks as it relates to control of entities. This class will not poll a particular joystick for input. For that you should use the DtJoystickEventManager class
| typedef boost::unordered_map<int, ControllerInformation> makVrv::DtJoystickManager::Controllers |
| typedef std::vector<DtGameControllerEventHandler*> makVrv::DtJoystickManager::GameControllerEventHandlers |
Returns the game controller event handlers.
|
protected |
|
protected |
Default deadzone percent by joystick device. Default is 2%.
|
protected |
| makVrv::DtJoystickManager::DtJoystickManager | ( | DtDe & | ) |
|
virtual |
|
static |
|
static |
Register a new joystick manager.
|
virtual |
Flushes all events in the SDL event queue.
|
virtual |
|
virtual |
Processes a mouse event on the channel. Currently does not process mouse events.
Implements makVrv::DtEventProcessorInterface.
|
virtual |
Processes a keyboard event on the channel.
Should return true if the event is handled successfully, and false to reject it and pass it on to the next event processor.
Implements makVrv::DtEventProcessorInterface.
|
virtual |
Returns true if there is a switch between group of the given name with an active controller for this configuration.
|
virtual |
Converts the SDL event into a given generic event. Do not delete the return pointer as it is reused by this class.
|
virtual |
Removes the game controller event handler specified.
|
virtual |
Inserts the game controller event handler at the beginning of the queue.
|
virtual |
Adds the game controller event handler to the end of the queue.
|
virtual |
Adds a new function group and function to the available function groups and functions. Signal is emitted when added.
|
virtual |
|
virtual |
Given the function group, return any function group that contains the same type of functions (not necessarily the same function names) as this group.
The functions must be specified in the same order of similarity
|
virtual |
Inserts the game controller handler before the specified handler. If handler does not exist adds to end.
|
inline |
|
virtual |
|
virtual |
|
virtual |
Returns all the device controllers that can be controlled by this game control information.
|
virtual |
|
virtual |
|
virtual |
| std::vector<std::string> makVrv::DtJoystickManager::functionsForFunctionGroup | ( | const std::string & | ) | const |
Returns all the functions in a particular function group.
|
virtual |
Sets the new favorite configuration. Will emit signal if configuration is different.
|
virtual |
|
virtual |
Locks the joystick manager from being allowed to accept updates to changing joystick controls.
When the simulation is in run mode and the user is controlling something this will be the case
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
inline |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Number of axis for a joystick.
|
virtual |
Number of buttons for a joystick.
|
virtual |
Number of hats for a joystick.
|
virtual |
Returns true if the given code and group needs a transitional value (i.e the value is just not on or off) If it is non-transitional then only button values are accepted.
|
virtual |
Returns true if the given code and group is a toggle value. If it is then only button values are accepted.
|
virtual |
Returns true if this is a cycle (0, 1, 2, etc) event.
|
virtual |
Supplies the min/max values of the given functionGroup and function.
|
virtual |
Loads default or factory record.
|
inline |
|
inline |
|
virtual |
Returns all the controllers currently available to map to.
| void makVrv::DtJoystickManager::exportSettings | ( | const std::string & | fileName | ) |
Exports the current cache settings to a file.
| void makVrv::DtJoystickManager::importSettings | ( | const std::string & | fileName | ) |
Import the current cache settings from a file.
|
virtual |
Returns controller information for the given function group and function or 0 if does not exist.
|
virtual |
Returns the description for the given function group and function.
|
virtual |
Removes all game controller currently registered.
|
virtual |
Removes controller information for the given group and function. If removed signal is sent.
|
virtual |
Adds controller information. If information exists it will be replaced with the new information. The given information is cloned.
|
virtual |
|
virtual |
|
virtual |
Returns true if the configuration name exists.
|
virtual |
Adds a new configuration.
|
virtual |
Removes the specified configuration.
|
virtual |
Returns true if at least one function in the function group is specified. If all flag is true then all must be specified.
|
virtual |
Returns true if the function group is specified and there is a controller available for it.
|
virtual |
Renames the configuration.
|
virtual |
|
virtual |
Returns all the devices used by the given function groups.
|
virtual |
Note this will return an empty map of function status that can be used to initiate a new function group by controller information.
Use this map to send messages to the back-end with current status for a particular functionGroup and function
|
staticprotected |
|
protectedvirtual |
|
protectedvirtual |
Returns the name of the processor class, to be used for identifying an event processor.
Implements makVrv::DtEventProcessorInterface.
|
protected |
Initialize to retrieve joysticks currently attached. Called from constructor.
|
protectedvirtual |
If we had sent an event, tell all controllers that no new events are queued.
|
protectedvirtual |
Poll event queue to see if a joystick has been added or removed.
|
protectedvirtual |
Initializes current joysticks and puts them into internal structures.
|
protectedvirtual |
Initializes current gamecontrollers and puts them into internal structures.
|
protectedvirtual |
Initializes any related keyboard information. Currently only one keyboard supported.
|
protectedvirtual |
Adds a new joystick device to the system based on SDL information. Emits a signal for joystick added.
|
protectedvirtual |
Removed the joystick. Emits the signal for joystick removed.
|
protectedvirtual |
Processes the controller event.
If watching will send off a signal. If in control of will create joystick control message and send that off
| boost::signal<void ()> makVrv::DtJoystickManager::signal_clear |
Signal sent when joystick information is cleared.
| boost::signal<void (int, int)> makVrv::DtJoystickManager::signal_joystickError |
Signal sent when there is an error with a particular joystick.
| boost::signal<void (const ControllerInformation&)> makVrv::DtJoystickManager::signal_controllerAdded |
Signal sent when a joystick is added.
| boost::signal<void (int)> makVrv::DtJoystickManager::signal_controllerRemoved |
Signal sent when a joystick is removed (by device index.
| boost::signal<void (const DtJoystickConfigurations&)> makVrv::DtJoystickManager::signal_configurationsChanged |
Signal send when joystick settings have changed.
| boost::signal<void (const std::string&, const DtJoystickConfigurationSettings&)> makVrv::DtJoystickManager::signal_settingsChanged |
| boost::signal<void (const std::string&, const std::string&)> makVrv::DtJoystickManager::signal_controllerInformationRemoved |
Signal sent when controller information is removed for the function group and function.
| boost::signal<void (const DtJoystickConfigurationSetting&)> makVrv::DtJoystickManager::signal_controllerInformationAdded |
Signal sent when controller information is added.
| boost::signal<void (const std::string& functionGroup, const std::string& function, const DtFunctionGroupInformation&)> makVrv::DtJoystickManager::signal_addedJoystickControlFunction |
Signal sent when a joystick control function is added.
| boost::signal<void (int, DtGenericControllerEvent*)> makVrv::DtJoystickManager::signal_gameControllerEvent |
Signal sent when a controller has an event.
| boost::signal<void (const std::string&)> makVrv::DtJoystickManager::signal_configurationAdded |
Signal sent when a new configuration is added.
| boost::signal<void (const std::string&)> makVrv::DtJoystickManager::signal_configurationRemoved |
Signal sent when a configuration is removed.
| boost::signal<void (const std::string& old, const std::string& renamed)> makVrv::DtJoystickManager::signal_configurationRenamed |
Signal sent when a configuration is renamed.
| boost::signal<void (bool)> makVrv::DtJoystickManager::signal_joystickManagerLockedForUpdates |
Signal sent when lock state changes.
| boost::signal<void (const std::string&, const std::string&)> makVrv::DtJoystickManager::signal_favoriteConfigurationChanged |
Signal sent when the favorite configuration has changed. Will send old/new favorite.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Used for event filtering so do not have to create on stack every time.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |