VR-Forces 5.0.1 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtForceManager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2021 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <vrvCore/vrvCore.h>
14 
16 #include <vrvUtil/event_signal.h>
17 
18 #include <vlpi/disEnums.h>
19 
20 #include <vector>
21 #include <map>
22 
23 namespace makVrv
24 {
25 
26  class DtSharedSettingsManager;
27 
28 #define FRIENDLY_COLOR .5f,224.f / 255.f, 1.f ,0.8f
29 #define FRIENDLY_PRIMARY_COLOR 0.f, 0.f, 1.f, 0.8f
30 #define OPPOSING_COLOR 1.f,.5f,.5f,0.8f
31 #define OPPOSING_PRIMARY_COLOR 1.f, 0.f, 0.f, 0.8f
32 #define NEUTRAL_COLOR 170.f / 255.f,1.f, 170.f / 255.f,0.8f
33 #define NEUTRAL_PRIMARY_COLOR 0.f, 1.f, 0.f, 0.8f
34 #define UNKNOWN_COLOR 1.f, 1.f, .5f, 0.8f
35 #define UNKNOWN_PRIMARY_COLOR 1.f, 1.f, 0.f, 0.8f
36 
41  {
42  public:
43 
44  struct RGBAColor
45  {
46  RGBAColor(float r, float g, float b, float a)
47  : R(r), G(g), B(b), A(a)
48  {
49  }
50 
52  : R(0.f), G(0.f), B(0.f), A(0.f)
53  {
54  }
55 
56  float R, G, B, A;
57  };
58 
59  public:
60 
63 
65  virtual ~DtForceManager();
66 
68  DtForceManager() = delete;
69 
71  DtForceManager(const DtForceManager&) = delete;
72 
74  DtForceManager& operator=(const DtForceManager&) = delete;
75 
76  public:
77 
78  static const std::string& className();
79 
82  virtual void addForce(DtForceType force, const std::string& forceName,
83  const RGBAColor& forceColor, const RGBAColor& forcePrimaryColor,
84  bool includeInDialogs = true);
85 
87  virtual void removeForce(DtForceType);
88 
90  virtual int numForces() const;
91 
93  virtual DtForceType forceAt(int iIndex) const;
94 
96  virtual RGBAColor colorForForce(DtForceType force,
97  bool usePrimaryColors=false) const;
98 
100  virtual std::string nameForForce(DtForceType force) const;
101 
103  virtual DtForceType forceFromName(const std::string& name) const;
104 
106  virtual bool includeInDialogs(DtForceType force) const;
107 
108  // Used by the entity editor
110  virtual void setHostility(DtU8 force, DtU8 targetForce, bool hostile);
111  virtual bool hostile(DtU8 force, DtU8 targetForce);
113 
115  virtual void clearForces();
116 
117  protected:
118 
119  struct ForceInfo
120  {
121  std::string myForceName;
125  std::vector<int> myHostilityList;
126  };
127 
128  // Information for a specific force
129  virtual const ForceInfo& forceInformation(DtForceType force) const;
130  virtual ForceInfo& forceInformation(DtForceType force);
131 
132 
134  std::map<DtForceType, ForceInfo> myForces;
135  };
136 
139  {
140  public:
141 
143  virtual ~DtSharedForceManagerSignaler();
144 
146  DtSharedForceManagerSignaler() = delete;
147 
150 
153 
154  protected:
155 
158 
159  public:
160 
166  instance( const DtSharedSettingsManager& mgr );
167 
172  instance( DtEventQueueInterface& eqi );
173 
180  findInstance( DtEventQueueInterface* eqi );
181 
184 
187 
190 
192 
193  };
194 }
Virtual base class. Allows for RTTI and proper virtual destruction. Used by Creators, Factories, Providers, Assemblers and User Interfaces.
Definition: DtVirtualBaseClass.h:19
event_signal< void(int)> signal_forceAdded
Emitted when a force is added.
Definition: DtForceManager.h:189
Definition: DtForceManager.h:44
RGBAColor(float r, float g, float b, float a)
Definition: DtForceManager.h:46
RGBAColor myForceColor
Definition: DtForceManager.h:122
std::map< DtForceType, ForceInfo > myForces
Definition: DtForceManager.h:134
The shared settings manager, is the global object responsible for managing any shared settings object...
Definition: DtSharedSettingsManager.h:42
This class will maintain force information used in visualizers that need force dependent data (such a...
Definition: DtForceManager.h:40
Contains makVrv::event_signal class.
The base class for all shared settings. Actual settings class should have the following members/decla...
Definition: DtSharedSettings.h:45
The event queue interface is a cross thread event queue used to emit event_signal across thread bound...
Definition: DtEventQueueInterface.h:26
Contains makVrv::DtVirtualBaseClass class.
Definition: DtForceManager.h:119
event_signal< void(int)> signal_forceRemoved
Emitted when a force is removed.
Definition: DtForceManager.h:186
#define DT_DLL_VRVCORE
Definition: vrvCore.h:20
Contains the DtSharedSettings class declaration.
float R
Definition: DtForceManager.h:56
std::vector< int > myHostilityList
Definition: DtForceManager.h:125
Shared signaler for the force manager to signal when a force is added or removed. ...
Definition: DtForceManager.h:138
RGBAColor myForcePrimaryColor
Definition: DtForceManager.h:123
ForceInfo myNullForce
Definition: DtForceManager.h:133
RGBAColor()
Definition: DtForceManager.h:51
std::string myForceName
Definition: DtForceManager.h:121
bool myIncludeInDialogs
Definition: DtForceManager.h:124
Contains DLL export macros.

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)