![]() |
VR-Forces Developer's Guide
|
This section describes the GUI architecture and various runtime implementation details.
For an introduction to GUI architecture, please see 2.7 - The GUI Layer.
A few dialog boxes in VR-Forces are standalone dialog boxes, rather than pagers or pages. These cannot be registered with the user interface assemblers, so they should be avoided if possible.
If you add new tasks or sets using the toolkit, you can simplify the process of creating dialog boxes for them by using the scripted task interface. Since VR-Forces automatically creates the dialog boxes for scripted tasks based on the metadata provided, you can use this interface by matching the script ID of the scripted task to the C++ task or set. For details, please see "Specifying the Programming Language for a Scripted Task", in VR-Forces Scenario Management Guide and the addTask example.
The DtDe needs to be ticked regularly by an event loop. We provide a default event loop, DtEventLoop, which you can customize by passing it a function pointer to your own event loop function. Use this method for applications that do not use the VR-Forces Qt plug-ins.
Qt requires you to use a Qt event loop. Therefore, if you are using one of the Qt plug-ins, it is impossible to use the DtEventLoop as your main event loop. Since the DtVrvApplication calls whichever DtEventLoop is registered with the DtDe, in order to use Qt and DtVrvApplication together you must create a DtEventLoop class that calls QApplication::exec() in its run function, and also make sure that the Qt event loop ticks the DtDe regularly, for instance with a QTimer. The DtQtEventLoop class installed by the vrvQtWidgets library does this with DtQtDeTicker. You can implement your own Qt event loop by subclassing QEventLoop. Please see the Qt documentation for more information about how to do this.
VR-Forces hashave various runtime settings, for example, enabling and disabling entity labels. These settings are owned by Settings Managers. Settings at runtime are DtDeSettings objects, owned by the DtDeSettingsManager. They are saved into the ./appData/settings directory, and the factory defaults are in ./factory/settings.
The ./appData/settings directory is the root directory for user settings, and each application has its own subdirectory (for example, ./appData/settings/stealth and ./appData/settings/vantageIG). Similarly, ./factory/settings is the factory settings root directory, with subdirectories for each application. The settings directories are configured by the DtDePathConfiguration. When an application wants to load a default settings file, it should check the user settings directory first. If no appropriate file is found, the factory settings directory should be checked.
Each DtDeSettings object is responsible for loading and saving itself. The settings objects can load and save from default files, factory files, or a specified file path. Please see DtDeSettings.h for detailed Toolkit documentation. You can get the DtDeSettings object for a particular group of settings from the DtDeSettingsManager, as follows:
VR-Forces uses Boost's serialization functionality for reading and writing files. A class that contains data that is to be read from disk and written to disk is called a record.
Record classes are part of the makArchives library. The guidelines for classes in this library are as follows:
Basic usage of records is as follows:
For the most part there is a specific DataRecord type for each file type. However, some records deviate from this standard. All files in ./appData/drivers are DtDriverRecord files, for example, DIS.DtDisDriver stores a DtDriverRecord. The file extension (.DtDisDriver) is the name of the driver class needed to use the file data.
Here is an example record:
To write a test record:
To read a test record:
VR-Forces saves most GUIconfiguration files as XML text files. Most files represent a single MAKArchive record encoded as XML. Each file generated by a different record class has a different file extension.
The following table lists the file extension, the record used to read and write the data, and the contents of the various configuration files saved by VR-Forces.
| Configuration File Formats | ||
|---|---|---|
| Extension | Record Class | Description |
| adsx | DtAggregateSettingsRecord | Aggregate display settings. |
| dcx | None | A display engine configuration. |
| DtDisDriver, DtHla13Driver, DtHla1516Driver, DtHla1516eDriver | DtDriverRecord | An instance of a driver to be created on startup. |
| edsx | DtSharedSimulationSettingsRecord | The simulation display settings. |
| elem | DtElementDefinitionRecord | Element definitions. |
| envx | DtEnvironmentRecord | The environment settings. |
| forx | DtForestSettingsRecord | The forest drawing settings. |
| grdx | DtGridLinesSettingsRecord | Grid line settings. |
| invx | DtIntervisibilitySettingsRecord | Intervisibility settings. |
| kmpx | DtKeyMapRecord | The keyboard to function mappings. |
| magx | Aggregate mappings. | |
| mdtx | DtEntityTypeMapping-Record | The entity type mappings for detonation effects. |
| metx | DtEntityTypeMapping-Record | The entity type mappings for entity models. |
| misx | DtInterestManagementRecord | Interest management settings. |
| mlsx | DtLoaderSettingsRecord | Loader settings. |
| mrsx | None | The render settings. |
| mtgx | Tactical graphics mappings. | |
| mwfx | DtEntityTypeMapping-Record | The entity type mappings for weapon fire effects. |
| omcx | DtObserverSettingsRecord | Observer mode settings. |
| ommx | DtModelDefinitionRecord | Model definitions. |
| osrx | DtObserverStateRecord | Observer state record (saved views file). |
| smtx | Schema settings. | |
| symx | DtSymbolDecorationSettingsRecord | Symbol decorator settings. |
| tdsx | DtTacticalGraphicsSettingsRecord | Tactical graphics display settings. |
| uisx | GUI layout settings. | |
| usdx | DtCacheSettingsRecord | The caching settings for the application. |
This section describes the GUI architecture and various runtime implementation details.
For an introduction to GUI architecture, please see 2.7 - The GUI Layer.