VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
joystickFunctionEnableHandler.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2015 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
10 
11 #pragma once
12 
17 
20 #include <vrvUtil/DtUnicode.h>
21 #include <vrvCore/DtStateView.h>
22 #include <vrvCore/DtEntityState.h>
23 
24 #include <string>
25 #include <map>
26 
27 #include <boost/signals2.hpp>
28 #include <boost/shared_ptr.hpp>
29 #include <boost/unordered_set.hpp>
30 #include <boost/unordered_map.hpp>
31 
32 namespace makVrv
33 {
34  class DtDe;
35  class DtJoystickManager;
36 
40  {
41  public:
44  {
46  ControlStatus(const ControlStatus& orig) : controlProcessor(orig.controlProcessor),
47  functionGroup(orig.functionGroup), function(orig.function), configuration(orig.configuration)
48  {
49  }
50  virtual ~ControlStatus() {};
51 
52  std::string functionGroup;
53  std::string function;
54  std::string configuration;
55  boost::shared_ptr<DtGameControlProcessor> controlProcessor;
56  };
57 
58  public:
61 
64 
66  virtual bool gameControllerEvent(DtGenericControllerEvent*);
67 
70  virtual void tick(bool sentEvents);
71 
73  virtual void gameControllerDeviceRemoved(int);
74 
76  virtual void gameControllerDeviceAdded(int);
77 
81  virtual bool enableJoystickFunctions(const std::string& configuration, const std::set<std::string>& functionalGroups,
82  std::set<std::string>& enabled);
83 
85  virtual bool inControlOfConfiguration(const std::string& configuration) const;
86 
89  virtual bool disableJoystickFunctions(const std::set<std::string>& functionalGroups,
90  std::set<std::string>& disabled);
91 
93  virtual std::set<std::string> controlledFunctionGroups() const;
94 
96  virtual bool canFunctionGroupBeAssigned(const std::string& functionGroup) const;
97 
99  virtual bool eventActive(DtGenericControllerEvent* sdlEvent) const;
100 
102  virtual bool canProcessEvent(DtGenericControllerEvent* sdlEvent) const;
103 
105  virtual bool anyFunctionGroupsActive() const;
106 
108  virtual void releaseAllControllerInformation();
109 
110  protected:
112  virtual bool filterGameControllerEvent(DtGenericControllerEvent*);
113 
115  virtual bool isFunctionGroupActive(const std::string& configuration, const std::string&) const;
116 
118  virtual void activateFunctionGroup(const std::string& configuration, const std::string&);
119 
121  virtual void deactivateFunctionGroup(const std::string& configuration, const std::string&);
122 
123  virtual void switchControlOfFunction(const std::string& configuration, const std::string& functionGroup);
124 
126  virtual void noQueuedEvents();
127 
130  virtual void gameControlInformationAdded(const std::string& configuration,
131  const std::string& functionGroup, const std::string& function, const DtGameControlInformation& i);
132 
136  virtual bool joystickFunctionFired(const std::string& functionGroup, const std::string& function,
137  double value, bool repeat, bool valueChanged) = 0;
138 
139  protected:
141  typedef std::vector<ControlStatus> ControlStatusVector;
142 
144  typedef std::map<std::string, ControlStatusVector> ControlStatusMap;
145  typedef std::map<int, ControlStatusMap> ControlledDevices;
147 
149  {
150  std::set<std::string> functionGroups;
151  std::map<std::string, std::set<std::string> > switchGroups;
152  std::map<std::string, int> switchGroupsIndex;
153  };
154 
156  typedef boost::unordered_map<std::string, ControlStruct> InControlOf;
158 
161 
162  typedef std::map<int, std::map<int, int> > LastJoystickAxisValue;
164 
166  typedef boost::unordered_map<DtGameControlProcessor*, std::pair<ControlStatus, DtGenericControllerEvent*> > RepeatQueue;
168 
170  };
171 }
std::vector< ControlStatus > ControlStatusVector
Devices that are controlled and their current status.
Definition: joystickFunctionEnableHandler.h:141
boost::unordered_map< DtGameControlProcessor *, std::pair< ControlStatus, DtGenericControllerEvent * > > RepeatQueue
Queue of funcutons that wish to get a repeat of an event if that event is not triggered (such as a bu...
Definition: joystickFunctionEnableHandler.h:166
Control processors that are keeping track of current values by function group and function...
Definition: joystickFunctionEnableHandler.h:43
boost::unordered_map< std::string, ControlStruct > InControlOf
Configurations that are controlled and their current switch status.
Definition: joystickFunctionEnableHandler.h:156
LastJoystickAxisValue myLastJoystickAxisValue
Definition: joystickFunctionEnableHandler.h:163
std::map< std::string, ControlStatusVector > ControlStatusMap
By function group.
Definition: joystickFunctionEnableHandler.h:144
InControlOf myInControlOf
Definition: joystickFunctionEnableHandler.h:157
Handler that you insert into the manager to be made aware of game controller events. A subclass of this handler can be added to the joystick manager to be made aware of any joystick/keyboard event.
Definition: joystickManager.h:42
This class will be used to query about current joysticks and the capabilities they might have...
Definition: joystickManager.h:96
ControlStatus()
Definition: joystickFunctionEnableHandler.h:45
Contains makVrv::DtStateView class.
std::set< std::string > functionGroups
Definition: joystickFunctionEnableHandler.h:150
Definition: joystickFunctionEnableHandler.h:148
Definition: gameControllerEvents.h:33
DtSignalConnectionManager myConnections
Definition: joystickFunctionEnableHandler.h:160
#define DT_DLL_JOYSTICKCORE
Contains DLL export macros.
Definition: joystickCore.h:25
Handler that will manage the objects that are taken control of for joystick controls and process the ...
Definition: joystickFunctionEnableHandler.h:39
Contains makVrv::DtVirtualBaseClass class.
DtDe & myDe
Definition: joystickFunctionEnableHandler.h:169
boost::shared_ptr< DtGameControlProcessor > controlProcessor
Definition: joystickFunctionEnableHandler.h:55
Class to manage disconnection of boost connections on deletion.
Definition: DtSignalConnectionManager.h:20
Contains makVrv::DtVrlinkSimulatedEntityState class.
std::map< std::string, std::set< std::string > > switchGroups
Definition: joystickFunctionEnableHandler.h:151
std::string configuration
Definition: joystickFunctionEnableHandler.h:54
The DtGameControlInformation class contains information about how a function within a function group ...
Definition: gameControlInformation.h:32
Base class to provide boost signal/slot management.
RepeatQueue myRepeatQueue
Definition: joystickFunctionEnableHandler.h:167
std::map< int, std::map< int, int > > LastJoystickAxisValue
Definition: joystickFunctionEnableHandler.h:162
virtual ~ControlStatus()
Definition: joystickFunctionEnableHandler.h:50
std::map< std::string, int > switchGroupsIndex
Definition: joystickFunctionEnableHandler.h:152
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer, DtDeCommunicator, as well as a DtDisplay and other things.
Definition: DtDe.h:70
std::map< int, ControlStatusMap > ControlledDevices
Definition: joystickFunctionEnableHandler.h:145
DtJoystickManager & myJoystickManager
Definition: joystickFunctionEnableHandler.h:159
ControlStatus(const ControlStatus &orig)
Definition: joystickFunctionEnableHandler.h:46
ControlledDevices myControlledDevices
Definition: joystickFunctionEnableHandler.h:146

Document ID: Generated on Mon Jun 20 00:38:30 EDT 2022 from SVN revision 244029
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)