This example shows how to register a function with the Key Map Manager, and bind it to a key event in a key map. In this example we use the DtDeSharedState method setPerformanceOverlayOn(), and bind the key event "'" [Down] in the "Observer Frame" key map (the default).
This example is a plug-in. You can run it by running ./bin64/exampleKeyMapPlugin_stealth.bat (on Windows) or ./bin64/exampleKeyMapPlugin_stealth.sh (on Linux). Hit the apostrophe key "'" to see the performance overlay display. For more information about running examples, please see Running Applications and Examples.
static vrvSignalsLib::connection postInitializeConnection;
void togglePerfOverlay(
DtDe* de)
{
{
}
else
{
state++;
}
}
void installKeyMapping(
DtDe& de)
{
keyMapManager.
addKeyFunction(
"Toggle Performance Overlay", boost::bind(
if (obsFrame)
{
"Toggle Performance Overlay");
}
}
{
{
&installKeyMapping, std::ref(de)));
}
}
{
return true;
}
Contains makVrv::DtDe class.
#define DT_DE_INIT_ONCE(de)
This macro is called by modules in their init() function. This macro ensures that the module is only ...
Definition DtDe.h:30
Contains makVrv::DtDeSharedState class.
Contains makVrv:DtMasterScene class.
Contains makVrv::DtImGuiLoaderStatsData class.
Contains makVrv::DtKeyMapManager class.
The DtDe is the core component of any VR-Vantage application. It owns a DtRenderer,...
Definition DtDe.h:77
virtual bool isInMasterMode() const
Returns true if the DtDe is in master mode.
virtual DtDriverManager & driverManager()
The DtMasterScene accessor. The function will throw before the initialize function is called.
boost::signalslib::signal< void()> signal_postInitialize
Definition DtDe.h:535
virtual DtDeSharedState & sharedState()
Returns the DtDeSharedState object.
virtual unsigned int performanceOverlayState() const
virtual void setPerformanceOverlayState(unsigned int state)
DtInputDriver & inputDriver()
Return the DtInputDriver associated with the master scene.
@ ProfilerOverlayStates_OFF
Definition DtImGuiLoaderStatsData.h:51
@ ProfilerOverlayStates_FULL
Definition DtImGuiLoaderStatsData.h:53
a Key Map contains a map of keys to FunctionMapEntrys, as well as a list of functions to execute when...
Definition DtKeyMap.h:313
The manager for owning key maps.
Definition DtKeyMapManager.h:32
@ Miscellaneous
Definition DtKeyMapManager.h:45
static DtKeyMapManager & instance(DtDe &de)
Get an instance of the key map.
virtual void addKeyFunction(const std::string &functionName, const KeyFunction &function, FunctionCategory functionCategory, bool categorize=true)
bind a function to string name that can be used in a key map (or binary function set)
virtual DtKeyMap * findKeyMap(const std::string &mapName)
look up a key map
@ KEY_APOSTROPHE
Definition DtKeyState.h:131
DT_DLL_EXAMPLEACCESSORY void init(makVrv::DtDe &de)
DT_DE_PLUGIN_EXPORT_MACRO bool initDeModule(makVrv::DtDe *de)
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16