mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-28 07:59:37 -06:00
Reduce fontsize of shutdown warning and center it instead with a dimming of the rendering (#1675)
* Reduce fontsize of shutdown warning and center it instead with a dimming of the rendering
This commit is contained in:
@@ -190,7 +190,7 @@ Fonts = {
|
||||
}
|
||||
FontSize = {
|
||||
FrameInfo = 32.0,
|
||||
Shutdown = 30.0,
|
||||
Shutdown = 14.0,
|
||||
Log = 8.0,
|
||||
CameraInfo = 12.0,
|
||||
VersionInfo = 12.0
|
||||
|
||||
@@ -1270,7 +1270,6 @@ void OpenSpaceEngine::drawOverlays() {
|
||||
|
||||
for (const std::function<void()>& func : *global::callback::draw2D) {
|
||||
ZoneScopedN("[Module] draw2D")
|
||||
|
||||
func();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
#include <ghoul/io/model/modelreaderassimp.h>
|
||||
#include <ghoul/io/model/modelreaderbinary.h>
|
||||
#include <ghoul/logging/logmanager.h>
|
||||
#include <ghoul/misc/easing.h>
|
||||
#include <ghoul/misc/profiling.h>
|
||||
#include <ghoul/misc/stringconversion.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
@@ -65,7 +66,7 @@
|
||||
|
||||
#ifdef GHOUL_USE_DEVIL
|
||||
#include <ghoul/io/texture/texturereaderdevil.h>
|
||||
#endif //GHOUL_USE_DEVIL
|
||||
#endif // GHOUL_USE_DEVIL
|
||||
#ifdef GHOUL_USE_FREEIMAGE
|
||||
#include <ghoul/io/texture/texturereaderfreeimage.h>
|
||||
#endif // GHOUL_USE_FREEIMAGE
|
||||
@@ -74,7 +75,7 @@
|
||||
#include <ghoul/io/texture/texturereadersoil.h>
|
||||
#include <ghoul/io/texture/texturewriter.h>
|
||||
#include <ghoul/io/texture/texturewritersoil.h>
|
||||
#endif //GHOUL_USE_SOIL
|
||||
#endif // GHOUL_USE_SOIL
|
||||
|
||||
#ifdef GHOUL_USE_STB_IMAGE
|
||||
#include <ghoul/io/texture/texturereaderstb.h>
|
||||
@@ -863,14 +864,9 @@ void RenderEngine::renderOverlays(const ShutdownInformation& shutdownInfo) {
|
||||
renderScreenLog();
|
||||
renderVersionInformation();
|
||||
renderDashboard();
|
||||
renderCameraInformation();
|
||||
|
||||
if (!shutdownInfo.inShutdown) {
|
||||
// We render the camera information in the same location as the shutdown info
|
||||
// and we won't need this if we are shutting down
|
||||
renderCameraInformation();
|
||||
}
|
||||
else {
|
||||
// If we are in shutdown mode, we can display the remaining time
|
||||
if (shutdownInfo.inShutdown) {
|
||||
renderShutdownInformation(shutdownInfo.timer, shutdownInfo.waitTime);
|
||||
}
|
||||
}
|
||||
@@ -890,12 +886,13 @@ void RenderEngine::renderEndscreen() {
|
||||
glm::vec2(global::windowDelegate->currentSubwindowSize()) / dpiScaling;
|
||||
glViewport(0, 0, res.x, res.y);
|
||||
|
||||
const glm::vec2 size = _fontShutdown->boundingBox("Shutting down");
|
||||
constexpr const std::string_view Text = "Shutting down";
|
||||
const glm::vec2 size = _fontShutdown->boundingBox(Text);
|
||||
glm::vec2 penPosition = glm::vec2(
|
||||
fontResolution().x / 2 - size.x / 2,
|
||||
fontResolution().y / 2 - size.y / 2
|
||||
);
|
||||
RenderFont(*_fontShutdown, penPosition, "Shutting down");
|
||||
RenderFont(*_fontShutdown, penPosition, Text);
|
||||
}
|
||||
|
||||
void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
|
||||
@@ -903,30 +900,42 @@ void RenderEngine::renderShutdownInformation(float timer, float fullTime) {
|
||||
|
||||
timer = std::max(timer, 0.f);
|
||||
|
||||
const glm::vec2 size = _fontShutdown->boundingBox(
|
||||
fmt::format("Shutdown in: {:.2f}s/{:.2f}s", timer, fullTime)
|
||||
// Render progressive overlay
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
// t = 1.f -> start of shutdown counter t = 0.f -> timer has reached shutdown
|
||||
float t = 1.f - (timer / fullTime);
|
||||
|
||||
rendering::helper::renderBox(
|
||||
glm::vec2(0.f),
|
||||
glm::vec2(1.f),
|
||||
glm::vec4(0.f, 0.f, 0.f, ghoul::circularEaseOut(t))
|
||||
);
|
||||
|
||||
// No need to print the text if we are just about to finish since otherwise we'll be
|
||||
// overplotting the actual "shutdown in progress" text
|
||||
if (timer == 0.f) {
|
||||
return;
|
||||
}
|
||||
|
||||
constexpr const std::string_view FirstLine = "Shutdown in: {:.2f}s/{:.2f}s";
|
||||
const glm::vec2 size1 = _fontShutdown->boundingBox(
|
||||
fmt::format(FirstLine, timer, fullTime)
|
||||
);
|
||||
|
||||
glm::vec2 penPosition = glm::vec2(
|
||||
fontResolution().x - size.x - 10,
|
||||
fontResolution().y - size.y
|
||||
fontResolution().x / 2 - size1.x / 2,
|
||||
fontResolution().y / 2 - size1.y / 2
|
||||
);
|
||||
|
||||
RenderFont(
|
||||
*_fontShutdown,
|
||||
penPosition,
|
||||
fmt::format("Shutdown in: {:.2f}s/{:.2f}s", timer, fullTime),
|
||||
ghoul::fontrendering::CrDirection::Down
|
||||
);
|
||||
|
||||
RenderFont(
|
||||
*_fontShutdown,
|
||||
penPosition,
|
||||
// Important: length of this string is the same as the shutdown time text
|
||||
// to make them align
|
||||
"Press ESC again to abort",
|
||||
fmt::format(FirstLine, timer, fullTime),
|
||||
ghoul::fontrendering::CrDirection::Down
|
||||
);
|
||||
// Important: Length of this string is the same as the first line to make them align
|
||||
RenderFont(*_fontShutdown, penPosition, "Press ESC again to abort");
|
||||
}
|
||||
|
||||
void RenderEngine::renderDashboard() {
|
||||
|
||||
Reference in New Issue
Block a user