VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
4 - GUI Architecture

This section describes the GUI architecture and various runtime implementation details.

For an introduction to GUI architecture, please see 2.7 - The GUI Layer.

3.1 - Standalone Dialog Boxes

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.

3.2 - The Event Loop

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.

3.2.1 Qt Event Loops

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.

3.3 - Runtime Settings

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.

3.3.1 Settings Directory Structure

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.

3.3.2 Loading and Saving Settings

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:

DtDeSettings* settings = DtDeSettingsManager::instance(myDe).findSettings("Settings Name");

3.4 - Records

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:

const std::string filename = "name.ext";
SomeDataRecord rec;
//To read a file.
makArchives::DtXmlFileIo::read(filename, rec, "Name");
//To write a file.
makArchives::DtXmlFileIo::write(filename, rec, "Name");

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:

class DtTestRecord
{
public:
// All values in a record *MUST* be initialized.
DtTestRecord()
: degrees(0)
, minutes(0)
, seconds(0.0)
{
}
DtTestRecord(int d, int m, float s)
: degrees(d)
, minutes(m)
, seconds(s)
{
}
int degrees;
int minutes;
float seconds;
protected:
friend class boost::serialization::access;
// When the class Archive corresponds to an output archive, the
// & operator is defined similar to <<. Likewise, when the class
// Archive is a type of input archive the & operator is defined
// similar to >>.
template<class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & BOOST_SERIALIZATION_NVP(degrees);
ar & BOOST_SERIALIZATION_NVP(minutes);
ar & BOOST_SERIALIZATION_NVP(seconds);
}
};

To write a test record:

std::string filePath = "testRecord.xml";
DtTestRecord data(35, 59, 24.567f);
makArchives::DtXmlFileIo::write(filePath, data, "DtTestRecord");

To read a test record:

std::string filePath = "testRecord.xml";
DtTestRecord data;
makArchives::DtXmlFileIo::read(filePath, data, "DtTestRecord");

3.5 - Configuration Files

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.


Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)