VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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/signals.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 
86  virtual bool disableJoystickFunctions(const std::set<std::string>& functionalGroups,
87  std::set<std::string>& disabled);
88 
90  virtual std::set<std::string> controlledFunctionGroups() const;
91 
93  virtual bool canFunctionGroupBeAssigned(const std::string& functionGroup) const;
94 
96  virtual bool eventActive(DtGenericControllerEvent* sdlEvent) const;
97 
99  virtual bool canProcessEvent(DtGenericControllerEvent* sdlEvent) const;
100 
102  virtual bool anyFunctionGroupsActive() const;
103 
105  virtual void releaseAllControllerInformation();
106 
107  protected:
109  virtual bool filterGameControllerEvent(DtGenericControllerEvent*);
110 
112  virtual bool isFunctionGroupActive(const std::string& configuration, const std::string&) const;
113 
115  virtual void activateFunctionGroup(const std::string& configuration, const std::string&);
116 
118  virtual void deactivateFunctionGroup(const std::string& configuration, const std::string&);
119 
120  virtual void switchControlOfFunction(const std::string& configuration, const std::string& functionGroup);
121 
123  virtual void noQueuedEvents();
124 
127  virtual void gameControlInformationAdded(const std::string& configuration,
128  const std::string& functionGroup, const std::string& function, const DtGameControlInformation& i);
129 
133  virtual bool joystickFunctionFired(const std::string& functionGroup, const std::string& function,
134  double value, bool repeat, bool valueChanged) = 0;
135 
136  protected:
138  typedef std::vector<ControlStatus> ControlStatusVector;
139 
141  typedef std::map<std::string, ControlStatusVector> ControlStatusMap;
142  typedef std::map<int, ControlStatusMap> ControlledDevices;
144 
146  {
147  std::set<std::string> functionGroups;
148  std::map<std::string, std::set<std::string> > switchGroups;
149  std::map<std::string, int> switchGroupsIndex;
150  };
151 
153  typedef boost::unordered_map<std::string, ControlStruct> InControlOf;
155 
158 
159  typedef std::map<int, std::map<int, int> > LastJoystickAxisValue;
161 
163  typedef boost::unordered_map<DtGameControlProcessor*, std::pair<ControlStatus, DtGenericControllerEvent*> > RepeatQueue;
165 
167  };
168 }

Document ID: Generated on Tue Mar 8 22:13:38 EST 2016 from SVN revision 162938
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)