mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-12 14:29:42 -05:00
Add possibility to check if OsEng is instantiated
This commit is contained in:
@@ -78,6 +78,7 @@ public:
|
||||
std::vector<std::string>& sgctArguments, bool& requestClose);
|
||||
static void destroy();
|
||||
static OpenSpaceEngine& ref();
|
||||
static bool isCreated();
|
||||
|
||||
double runTime();
|
||||
void setRunTime(double t);
|
||||
|
||||
@@ -49,6 +49,15 @@ OnScreenGUIModule::OnScreenGUIModule()
|
||||
{
|
||||
addPropertySubOwner(gui);
|
||||
|
||||
// TODO: Remove dependency on OsEng.
|
||||
// Instead, make this class implement an interface that OsEng depends on.
|
||||
// Do not try to register module callbacks if OsEng does not exist,
|
||||
// for example in the TaskRunner.
|
||||
|
||||
if (!OpenSpaceEngine::isCreated()) {
|
||||
return;
|
||||
}
|
||||
|
||||
OsEng.registerModuleCallback(
|
||||
OpenSpaceEngine::CallbackOption::Initialize,
|
||||
[](){
|
||||
|
||||
@@ -185,6 +185,10 @@ OpenSpaceEngine& OpenSpaceEngine::ref() {
|
||||
return *_engine;
|
||||
}
|
||||
|
||||
bool OpenSpaceEngine::isCreated() {
|
||||
return _engine != nullptr;
|
||||
}
|
||||
|
||||
void OpenSpaceEngine::create(int argc, char** argv,
|
||||
std::unique_ptr<WindowWrapper> windowWrapper,
|
||||
std::vector<std::string>& sgctArguments, bool& requestClose)
|
||||
|
||||
Reference in New Issue
Block a user