Add possibility to check if OsEng is instantiated

This commit is contained in:
Emil Axelsson
2017-06-01 14:09:06 +02:00
parent f231ca290e
commit 5c67189c8d
3 changed files with 14 additions and 0 deletions
@@ -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,
[](){
+4
View File
@@ -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)