![]() |
VR-Forces 5.0.2 Developer's Guide
|
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.

Classes | |
| struct | ControllerInformation |
Public Types | |
| typedef boost::unordered_map < int, ControllerInformation > | Controllers |
| typedef std::vector < DtGameControllerEventHandler * > | GameControllerEventHandlers |
Public Member Functions | |
| DtJoystickManager (DtDe &) | |
| virtual | ~DtJoystickManager () |
| virtual void | flushAllEvents () |
| virtual ControllerInformation | controllerInformation (int deviceId) const |
| virtual bool | processMouseEvent (const DtMouseEvent &ev, DtChannel &channel) |
| virtual bool | processKeyboardEvent (const DtKeyEvent &ev, DtChannel &channel) |
| virtual bool | switchControlActive (const std::string &configuration, const std::string &switchGroup) const |
| virtual DtGenericControllerEvent * | genericEventFromSDLEvent (const SDL_Event &) |
| virtual void | removeGameControllerEventHandler (DtGameControllerEventHandler *) |
| virtual void | addGameControllerEventHandlerToFront (DtGameControllerEventHandler *) |
| virtual void | addGameControllerEventHandlerToEnd (DtGameControllerEventHandler *) |
| virtual void | addJoystickControlFunction (const std::string &functionGroup, const std::string &function, const DtFunctionGroupInformation &) |
| 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 |
| virtual void | insertGameControllerEventHandlerBefore (DtGameControllerEventHandler *, DtGameControllerEventHandler *) |
| 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 |
| 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 |
| virtual void | setFavoriteConfiguration (const std::string &) |
| virtual const std::string & | favoriteConfiguration () const |
| virtual void | increaseLockCount () |
| 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 |
| virtual int | numJoystickButtons (int deviceIndex) const |
| virtual int | numJoystickHats (int deviceIndex) const |
| virtual bool | needsTransition (const std::string &functionalGroup, const std::string &function) const |
| virtual bool | toggle (const std::string &functionalGroup, const std::string &function) const |
| virtual bool | cycle (const std::string &functionGroup, const std::string &function) const |
| virtual void | getFunctionMinMaxValues (const std::string &functionalGroup, const std::string &function, double &min, double &max) const |
| virtual void | loadDefaults (bool fromFactory=false) |
| const DtRecordSettingsBackupInterface * | settingsBackup () const |
| DtRecordSettingsBackupInterface * | settingsBackup () |
| virtual Controllers | controllers () const |
| void | exportSettings (const std::string &fileName) |
| void | importSettings (const std::string &fileName) |
| virtual DtGameControlInformation | gameControlInformationFor (const std::string &configuration, const std::string &functionGroup, const std::string &function) const |
| virtual std::string | descriptionFor (const std::string &functionGroup, const std::string &function) const |
| virtual void | removeAllGameControllers () |
| virtual void | removeGameControlInformationFor (const std::string &configuration, const std::string &functionGroup, const std::string &function) |
| virtual void | addGameControlInformationFor (const std::string &configuration, const std::string &functionGroup, const std::string &function, const DtGameControlInformation &) |
| virtual void | setAutoSave (bool) |
| virtual bool | autoSave () const |
| virtual bool | hasConfigurationName (const std::string &) const |
| virtual void | addConfiguration (const std::string &) |
| virtual void | removeConfiguration (const std::string &) |
| virtual bool | functionGroupSpecified (const std::string &configuration, const std::string &functionGroup, bool all=false) const |
| virtual bool | canFunctionGroupBeAssigned (const std::string &configuration, const std::string &functionGroup, bool all=false) const |
| virtual void | renameConfiguration (const std::string &old, const std::string &renamed) |
| virtual void | saveAsDefaults () |
| virtual DtJoystickConfigurationSettings::GameControlInformation | gameControlInformation (const std::string &configuration, const std::set< std::string > &) const |
| virtual DtJoystickConfigurationSettings::GameControlInformation | gameControlInformation (const std::string &configuration, const std::string &) const |
| virtual void | getSplitRecord (std::vector< DtJoystickConfigurations > &rec, std::vector< std::string > &fileNames) |
| virtual void | addRecords (DtJoystickConfigurations &recs, DtJoystickConfigurations &combinedRec) |
Public Member Functions inherited from makVrv::DtEventProcessorInterface | |
| DtEventProcessorInterface () | |
| virtual | ~DtEventProcessorInterface () |
| virtual bool | processPinchGesture (const DtPinchGesture &ev, DtChannel &channel) |
| virtual void | setEnabled (bool b) |
| bool | enabled () const |
Public Member Functions inherited from makVrv::DtVirtualBaseClass | |
| DtVirtualBaseClass () | |
| virtual | ~DtVirtualBaseClass () |
Static Public Member Functions | |
| static DtJoystickManager & | instance (DtDe &de) |
| static void | registerInstance (DtDe &de, DtJoystickManager *) |
Public Attributes | |
| boost::signals2::signal< void()> | signal_clear |
| boost::signals2::signal< void(int, int)> | signal_joystickError |
| boost::signals2::signal< void(const ControllerInformation &)> | signal_controllerAdded |
| boost::signals2::signal< void(int)> | signal_controllerRemoved |
| boost::signals2::signal< void(const DtJoystickConfigurations &)> | signal_configurationsChanged |
| boost::signals2::signal< void(const std::string &, const DtJoystickConfigurationSettings &)> | signal_settingsChanged |
| boost::signals2::signal< void(const std::string &, const std::string &)> | signal_controllerInformationRemoved |
| boost::signals2::signal< void(const DtJoystickConfigurationSetting &)> | signal_controllerInformationAdded |
| boost::signals2::signal< void(const std::string &functionGroup, const std::string &function, const DtFunctionGroupInformation &)> | signal_addedJoystickControlFunction |
| boost::signals2::signal< void(const std::string &)> | signal_configurationAdded |
| boost::signals2::signal< void(const std::string &)> | signal_configurationRemoved |
| boost::signals2::signal< void(const std::string &old, const std::string &renamed)> | signal_configurationRenamed |
| boost::signals2::signal< void(bool)> | signal_joystickManagerLockedForUpdates |
| boost::signals2::signal< void(const std::string &, const std::string &)> | signal_favoriteConfigurationChanged |
Protected Types | |
| typedef std::map< int, DtJoystickDevice > | Joysticks |
| typedef std::map< std::string, std::set< int > > | JoysticksByGuid |
| typedef std::map< int, double > | JoystickDeadzonePercent |
| typedef std::vector < DtGenericControllerEvent * > | JoystickEventQueue |
Protected Member Functions | |
| virtual int | sdlEventFilter (SDL_Event *event) |
| virtual const std::string & | className () |
| void | initialize () |
| virtual void | sendNoQueuedEvents () |
| virtual void | tick () |
| virtual void | initializeJoysticks () |
| virtual void | initializeGameControllers () |
| virtual void | initializeKeyboard () |
| virtual void | addJoystickDevice (int deviceId) |
| virtual void | removeJoystickDevice (int deviceId) |
| virtual bool | processControllerEvent (DtGenericControllerEvent *) |
Static Protected Member Functions | |
| static int | sdlEventFilterCallback (void *userdata, SDL_Event *event) |
| typedef boost::unordered_map<int, ControllerInformation> makVrv::DtJoystickManager::Controllers |
| typedef std::vector<DtGameControllerEventHandler*> makVrv::DtJoystickManager::GameControllerEventHandlers |
Returns the game controller event handlers.
|
protected |
|
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 |
| 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 |
|
inline |
|
virtual |
|
virtual |
|
virtual |
Number of axis for a joystick.
Number of buttons for a joystick.
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.
|
inlinevirtual |
To support writing element definitions in folders as multiple files not implemented.
|
inlinevirtual |
To support writing element definitions in folders as multiple files not implemented.
|
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::signals2::signal<void ()> makVrv::DtJoystickManager::signal_clear |
Signal sent when joystick information is cleared.
Signal sent when there is an error with a particular joystick.
| boost::signals2::signal<void (const ControllerInformation&)> makVrv::DtJoystickManager::signal_controllerAdded |
Signal sent when a joystick is added.
| boost::signals2::signal<void (int)> makVrv::DtJoystickManager::signal_controllerRemoved |
Signal sent when a joystick is removed (by device index.
| boost::signals2::signal<void (const DtJoystickConfigurations&)> makVrv::DtJoystickManager::signal_configurationsChanged |
Signal send when joystick settings have changed.
| boost::signals2::signal<void (const std::string&, const DtJoystickConfigurationSettings&)> makVrv::DtJoystickManager::signal_settingsChanged |
| boost::signals2::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::signals2::signal<void (const DtJoystickConfigurationSetting&)> makVrv::DtJoystickManager::signal_controllerInformationAdded |
Signal sent when controller information is added.
| boost::signals2::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::signals2::signal<void (const std::string&)> makVrv::DtJoystickManager::signal_configurationAdded |
Signal sent when a new configuration is added.
| boost::signals2::signal<void (const std::string&)> makVrv::DtJoystickManager::signal_configurationRemoved |
Signal sent when a configuration is removed.
| boost::signals2::signal<void (const std::string& old, const std::string& renamed)> makVrv::DtJoystickManager::signal_configurationRenamed |
Signal sent when a configuration is renamed.
| boost::signals2::signal<void (bool)> makVrv::DtJoystickManager::signal_joystickManagerLockedForUpdates |
Signal sent when lock state changes.
| boost::signals2::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 |
|
protected |
Used for event filtering so do not have to create on stack every time.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |