From 12ddfae3376d9564ede35c0626628488d1027ac7 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Thu, 30 Nov 2017 21:17:18 -0500 Subject: [PATCH] Compile fix in TimeConversion Reenable display of shutdown timer Add prompt informing the user of ability to abort --- src/engine/openspaceengine.cpp | 4 ++++ src/rendering/renderengine.cpp | 9 +++++++++ src/util/timeconversion.cpp | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/engine/openspaceengine.cpp b/src/engine/openspaceengine.cpp index 9eeacc42e8..9d0809cf5a 100644 --- a/src/engine/openspaceengine.cpp +++ b/src/engine/openspaceengine.cpp @@ -1319,6 +1319,10 @@ void OpenSpaceEngine::drawOverlays() { // and we won't need this if we are shutting down _renderEngine->renderCameraInformation(); } + else { + // If we are in shutdown mode, we can display the remaining time + _renderEngine->renderShutdownInformation(_shutdown.timer, _shutdown.waitTime); + } _console->render(); } diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 6515c36ef7..c641cd24f1 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -598,6 +598,15 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) { timer, fullTime ); + + RenderFontCr( + *_fontDate, + penPosition, + "%s", + // Important: length of this string is the same as the shutdown time text + // to make them align + "Press ESC again to abort" + ); } void RenderEngine::postDraw() { diff --git a/src/util/timeconversion.cpp b/src/util/timeconversion.cpp index ec3647c2bb..badd95a2c2 100644 --- a/src/util/timeconversion.cpp +++ b/src/util/timeconversion.cpp @@ -24,6 +24,8 @@ #include +#include + #include namespace { @@ -43,7 +45,7 @@ namespace { namespace openspace { std::pair simplifyTime(double seconds) { - double secondsVal = abs(seconds); + double secondsVal = glm::abs(seconds); if (secondsVal > 1e-3 && secondsVal < SecondsPerMinute) { return { seconds, seconds == 1.0 ? "second" : "seconds" };