![]() |
VR-Forces Developer's Guide
|
This class's main responsibility is to handle keyboard and mouse events from OSG (Qt events are routed through OSG when a Qt window is used).

Public Types | |
| typedef std::list < DtEventProcessorInterface * > | EventProcessorList |
| typedef std::map< std::string, makArchives::DtObserverStateRecord > | ObserverStateMap |
| typedef std::map< std::string, DtObserverConfiguration > | ObserverConfigurationMap |
Protected Types | |
| typedef std::map< std::string, DtObserver * > | ObserversMap |
Protected Member Functions | |
| void | setCurrentObserver (DtObserver *observer) |
| virtual void | initializeKeyMapManager (const std::string &defaultKeyMap) |
| virtual void | bindFunctions () |
| virtual void | createMaps () |
| virtual void | loadMaps (bool loadFromFactory=false) |
| void | removeObserver (ObserversMap &observers, DtObserver *observer) |
| void | removeObserver (ObserversMap &observers, const std::string &name) |
| void | destroyObservers () |
| bool | setCurrentObserverFromChannel (const DtChannel &channel) |
| void | slot_channelCreated (DtChannelManager *channelManager, DtChannel *channel) |
| void | slot_channelDestroyed (DtChannelManager *channelManager, DtChannel *channel) |
| void | slot_channelConfigurationModified (const std::string &deName, const std::string &winName, const std::string &oldChannelName, const DtChannelConfiguration &config) |
| void | slot_attachedToChanged (DtObserver *observer) |
| void | createRequiredObservers (const std::string &engineName) |
| virtual void | slot_displayEngineAdded (const DtDeRecord &igRecord) |
| std::string | restoreObserversPart1 () |
| void | restoreObserversPart2 (const std::string &filename) |
| virtual void | slot_displayEngineRealized (const std::string &, const std::string &engineName) |
| bool | trimmedMatch (DtObserver *observer) |
| bool | showObserverNameWarning () |
| void | setShowObserverNameWarning (bool warn) |
Protected Member Functions inherited from makVrv::DtDriver | |
| void | applyChangesAndDelete (DtElementChanges *changes) |
| void | reportElementCreated (DtElementID id, DtElementID parentId, DtElementEntry::ElementType type) |
| void | reportElementAttribute (DtElementID id, DtElementAttribute *attribute) |
| void | reportElementDestroyed (DtElementID id) |
| void | start () |
| void | stop () |
| bool | tick () |
| virtual void | setInstanceName (const std::string &name) |
| virtual void | installAccessories () |
| virtual void | uninstallAccessories () |
Private Member Functions | |
| DtInputDriver (const DtInputDriver &) | |
| DtInputDriver & | operator= (const DtInputDriver &) |
Additional Inherited Members | |
Static Protected Attributes inherited from makVrv::DtDriver | |
| static const std::string | theOnDriverSelectionList |
| typedef std::list<DtEventProcessorInterface*> makVrv::DtInputDriver::EventProcessorList |
A list of DtEventProcessorInterface, called in order for each event until one handles it.
| typedef std::map<std::string, makArchives::DtObserverStateRecord> makVrv::DtInputDriver::ObserverStateMap |
A map of observer names, to DtObserverStateRecords.
| typedef std::map<std::string, DtObserverConfiguration> makVrv::DtInputDriver::ObserverConfigurationMap |
A map of observer names, to DtObserverConfigurations.
|
protected |
Observer Manager bound.
| makVrv::DtInputDriver::DtInputDriver | ( | DtAgentManager & | agentManager, |
| const std::string & | instanceName | ||
| ) |
CTOR.
|
virtual |
DTOR.
|
private |
Copy Constructor (not implemented)
|
virtual |
Create and initialize our listener.
Implements makVrv::DtDriver.
|
virtual |
Uninitialize and destroy our listener.
Implements makVrv::DtDriver.
|
virtual |
Tick our keyboard/mouse listener.
Implements makVrv::DtDriver.
|
virtual |
Get the class name for the input driver.
Implements makVrv::DtDriver.
|
virtual |
handle a key event from our listener
|
virtual |
handle a mouse event from our listener
Reimplemented in makVrf::DtVrfInputDriver.
|
virtual |
|
virtual |
Enable/Disable myMouseHideProcessor which, if enabled,.
|
virtual |
hide the mouse cursor
|
virtual |
Check to see if the mouse is hidden.
|
virtual |
show the mouse cursor
|
virtual |
warp the mouse cursor to the center of the view
|
virtual |
warp the mouse cursor to the given window position
|
virtual |
clear any remembered keyboard modifiers and stop any observer motion
| DtChannel* makVrv::DtInputDriver::currentChannel | ( | ) | const |
the last channel a mouse or keyboard event was received in. Note that this may be Null if no events have happened on any channel OR if the last channel that received an event has been destroyed. Do not hold onto channel pointers unless you are also listening for channelToBeDestroyed signals. The 'currentChannel()' form is deprecated. Our naming convention requires methods that return pointers that may be NULL to start with 'find'
|
virtual |
the last channel a mouse or keyboard event was received in. Note that this may be Null if no events have happened on any channel OR if the last channel that received an event has been destroyed. Do not hold onto channel pointers unless you are also listening for channelToBeDestroyed signals. The 'currentChannel()' form is deprecated. Our naming convention requires methods that return pointers that may be NULL to start with 'find'
|
virtual |
This transfers resource management of the event processor to the input driver.
|
virtual |
Add an event processor to the driver. It will be added to the back of the processor list in priority. This transfers resource management of the event processor to the input driver.
|
virtual |
Get the list of event processors. Intended for more complex ordering of several event processors by mutating the list. Processors in the list are managed by the input driver.
|
virtual |
Find an event processor owned by the input driver that has the specified class name. Returns 0 if none is found.
|
virtual |
Remove an event processor from the driver. This will remove the first processor in the list that matches the passed-in pointer. This relinquishes resource management of the event processor from the input driver.
| bool makVrv::DtInputDriver::saveKeyMapToFile | ( | const DtKeyMap & | keyMap, |
| const std::string & | filename | ||
| ) | const |
Save a key map to a file.
| DtKeyMap* makVrv::DtInputDriver::loadKeyMapFromFile | ( | const std::string & | filename, |
| bool | createBackup = false |
||
| ) |
Save a key map to a file. If createBackup is true, creates a backup object in the key map manager to manage key map backups.
| void makVrv::DtInputDriver::setKeyMap | ( | const std::string & | mapName | ) |
explicitly set a key map
Note that if you name a map that does not exist, the input driver will throw an exception
| const std::string& makVrv::DtInputDriver::keyMap | ( | ) | const |
Get the name of the current keyMap.
| DtKeyMap* makVrv::DtInputDriver::createKeyMap | ( | const std::string & | mapName | ) |
create a (blank) key map
| DtKeyMap* makVrv::DtInputDriver::findKeyMap | ( | const std::string & | mapName | ) |
lookup a key map
| void makVrv::DtInputDriver::addKeyBinding | ( | DtKeyMap * | map, |
| DtKeyState::KeyType | key, | ||
| const std::string & | functionName, | ||
| DtKeyState::KeyModifier | modifiers = DtKeyState::NO_MODIFIER, |
||
| bool | replace = false, |
||
| DtKeyEvent::KeyEventType | eventType = DtKeyEvent::KEY_DOWN |
||
| ) |
bind a key down or key up event (possibly modified) to a function name
| void makVrv::DtInputDriver::addBinaryKeyBinding | ( | DtKeyMap * | map, |
| DtKeyState::KeyType | key, | ||
| const std::string & | binaryName, | ||
| DtKeyState::KeyModifier | modifiers = DtKeyState::NO_MODIFIER, |
||
| bool | replace = false |
||
| ) |
bind the up and down events for a key (possibly modified) to a binary function set
|
virtual |
Realize the driver using the configuration.
Reimplemented from makVrv::DtDriver.
|
virtual |
| const ObserverConfigurationMap& makVrv::DtInputDriver::observerConfigurations | ( | ) | const |
| void makVrv::DtInputDriver::addObserverConfiguration | ( | const DtObserverConfiguration & | config | ) |
Observer name is already in the config... If the input driver is already started, this will create the observer indicated. In any event, the configuration goes onto the configuration list (so it will be created on inputDriver start) N.B. This method will throw an exception if you attempt to add an observer configuration for an observer that already exists.
| void makVrv::DtInputDriver::addObserverState | ( | const std::string & | observerName, |
| const makArchives::DtObserverStateRecord & | stateRecord | ||
| ) |
put this state onto the observerState map and, if the observer currently exists, set its state from this record
| void makVrv::DtInputDriver::initializeObserver | ( | DtObserver * | observer, |
| const makArchives::DtObserverStateRecord & | stateRecord | ||
| ) |
set the state of the specified observer from stateRecord. This does NOT put the state record onto the onbserverState map; use addObserverState to do that
|
virtual |
Observer Management.
add an observer object to the manager
|
virtual |
Remove an observer object from the manager.
|
virtual |
Remove an observer object from the manager.
|
virtual |
Get a list of all observers.
|
virtual |
Find an observer by its name.
|
virtual |
Find an observer by its name.
|
virtual |
Set the current observer by name.
| DtObserver* makVrv::DtInputDriver::currentObserver | ( | ) | const |
Get the current observer. This will be the observer that controls the last channel that we received any mouse or keyboard events on (and on startup, especially, it's possible that no key or mouse events have happened yet, this may return NULL. The 'currentObserver()' form is deprecated. Our naming convention requires methods that return pointers that may be NULL to start with 'find'.
|
virtual |
Get the current observer. This will be the observer that controls the last channel that we received any mouse or keyboard events on (and on startup, especially, it's possible that no key or mouse events have happened yet, this may return NULL. The 'currentObserver()' form is deprecated. Our naming convention requires methods that return pointers that may be NULL to start with 'find'.
| void makVrv::DtInputDriver::setTerrainContextEnabled | ( | bool | enabled | ) |
Set whether terrain context menus are enabed.
| bool makVrv::DtInputDriver::terrainContextEnabled | ( | ) | const |
|
virtual |
View controls:
Run a function on the "main" observer
|
virtual |
Toggle terrain scaling on or off.
|
virtual |
Toggle wireframe mode on or off.
|
virtual |
Toggle sim time pause on or off.
|
virtual |
Increment terrain scale factor.
|
virtual |
Decrement terrain scale factor.
|
virtual |
Toggle entity labels on or off.
|
virtual |
Toggle embarked entity labels on or off.
|
virtual |
Toggle entity symbol rotate on or off.
|
virtual |
Toggle tactical graphics display on or off.
|
virtual |
Toggle entity height above terrain lines display on or off.
|
virtual |
Toggle tactical graphics height above terrain lines display on or off.
|
virtual |
Toggle entity height above terrain mode.
|
virtual |
Toggle tactical graphics height above terrain mode.
|
virtual |
Toggle show active tactical graphics on or off.
|
virtual |
Toggles the transparency of all selected props.
|
virtual |
Toggle global listening to view controls (does not affect VR-Link driver view control listening overrides)
| void makVrv::DtInputDriver::resetObservers | ( | DtUniqueID | id | ) |
Reset all of the observers to the unique id.
|
virtual |
Control whether reset observers functions or not. This is used during saving/loading scene for connecting slaves not to modify the observers.
|
virtual |
|
virtual |
Control whether the observers are saved and restored when the slave is connected Turned off during postInit so that if a terrain is loaded on the command line and the slave is connected on the command line then it won't jump to the origin after connection.
|
virtual |
| void makVrv::DtInputDriver::saveObservers | ( | const std::string & | filename | ) |
Create an observer settings file.
| void makVrv::DtInputDriver::loadObservers | ( | const std::string & | filename, |
| bool | force = false |
||
| ) |
Load an observer settings file. This method won't actually load an observer if it thinks its waiting for an entity to attach to the force parameter overrides that.
| DtElementEntry::ObjectType makVrv::DtInputDriver::typeFromId | ( | const DtUniqueID & | id | ) |
|
virtual |
Animate an observer to a given absolute location and orientation. The input driver takes control of the animator object; do not delete.
|
virtual |
Remove the animator associated with the specified observer.
|
virtual |
Takes Screen capture of the current channel.
|
virtual |
Toggle ImGui based debug ui.
| const DtObserverViewsManager& makVrv::DtInputDriver::observerViewsManager | ( | ) | const |
Returns the observer view list manager.
| DtObserverViewsManager& makVrv::DtInputDriver::observerViewsManager | ( | ) |
Returns the observer view list manager.
Return the position of the last processed mouse event.
| DtChannel* makVrv::DtInputDriver::lastMouseEventChannel | ( | ) | const |
Return a pointer to the channel of the last processed mouse event.
|
protected |
|
protectedvirtual |
This will eventually load up key maps.
|
protectedvirtual |
|
protectedvirtual |
This creates the default key maps by hand. Kept around for now.
|
protectedvirtual |
Load all the key maps (*.kmpx) files in the $APP_DIR/settings directory. If loadFromFactory is true, loads from factory directory, not app directory.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedvirtual |
Called when a display engine is added. Restarts this driver.
Reimplemented from makVrv::DtDriver.
|
protected |
Create a temporary observer settings file using a default filename - called when a display engine is added, before shutting down. Returns the name of the file.
|
protected |
Loads a temporary observer settings file and deletes the file.
|
protectedvirtual |
|
protected |
Helper function for bindObserver where is a user does Observer1, Observer2 instead of Observer1,Observer2 it will still match.
|
protected |
Is trimmedMatch showing warnings?
|
protected |
Set whether to warn if an observer name is not in our start up list.
|
private |
Assignment Operator (not implemented)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Temp, so we can look this up ONCE each event.
|
protected |
Control whether observers can be reset.
|
protected |
Switch to enable or disable terrain context menus;.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |