mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-22 04:49:12 -06:00
Correctly advance dashboarditem pen position before rendering instead of afterwards (closes #3067)
This commit is contained in:
@@ -272,8 +272,8 @@ void DashboardItemAngle::render(glm::vec2& penPosition) {
|
||||
_buffer.data(),
|
||||
end - _buffer.data()
|
||||
);
|
||||
RenderFont(*_font, penPosition, text);
|
||||
penPosition.y -= _font->height();
|
||||
RenderFont(*_font, penPosition, text);
|
||||
}
|
||||
else {
|
||||
const double angle = glm::degrees(
|
||||
@@ -288,8 +288,8 @@ void DashboardItemAngle::render(glm::vec2& penPosition) {
|
||||
const std::string_view text = std::string_view(
|
||||
_buffer.data(), end - _buffer.data()
|
||||
);
|
||||
RenderFont(*_font, penPosition, text);
|
||||
penPosition.y -= _font->height();
|
||||
RenderFont(*_font, penPosition, text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ void DashboardItemDate::render(glm::vec2& penPosition) {
|
||||
);
|
||||
|
||||
try {
|
||||
penPosition.y -= _font->height();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
@@ -103,7 +104,6 @@ void DashboardItemDate::render(glm::vec2& penPosition) {
|
||||
catch (const std::format_error&) {
|
||||
LERRORC("DashboardItemDate", "Illegal format string");
|
||||
}
|
||||
penPosition.y -= _font->height();
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemDate::size() const {
|
||||
|
||||
@@ -377,13 +377,13 @@ void DashboardItemDistance::render(glm::vec2& penPosition) {
|
||||
)
|
||||
);
|
||||
|
||||
penPosition.y -= _font->height();
|
||||
const std::string_view t = std::string_view(_buffer.data(), end - _buffer.data());
|
||||
RenderFont(*_font, penPosition, t);
|
||||
}
|
||||
catch (const std::format_error&) {
|
||||
LERRORC("DashboardItemDate", "Illegal format string");
|
||||
}
|
||||
penPosition.y -= _font->height();
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemDistance::size() const {
|
||||
|
||||
@@ -140,6 +140,8 @@ void DashboardItemElapsedTime::render(glm::vec2& penPosition) {
|
||||
|
||||
const double delta = global::timeManager->time().j2000Seconds() - _referenceJ2000;
|
||||
|
||||
penPosition.y -= _font->height();
|
||||
|
||||
if (_simplifyTime) {
|
||||
using namespace std::chrono;
|
||||
|
||||
@@ -176,8 +178,6 @@ void DashboardItemElapsedTime::render(glm::vec2& penPosition) {
|
||||
std::vformat(_formatString.value(), std::make_format_args(time))
|
||||
);
|
||||
}
|
||||
|
||||
penPosition.y -= _font->height();
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemElapsedTime::size() const {
|
||||
|
||||
@@ -237,12 +237,8 @@ void DashboardItemFramerate::render(glm::vec2& penPosition) {
|
||||
0 :
|
||||
static_cast<int>((std::count(text.begin(), text.end(), '\n') + 1));
|
||||
|
||||
ghoul::fontrendering::FontRenderer::defaultRenderer().render(
|
||||
*_font,
|
||||
penPosition,
|
||||
text
|
||||
);
|
||||
penPosition.y -= _font->height() * static_cast<float>(nLines);
|
||||
RenderFont(*_font, penPosition, text);
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemFramerate::size() const {
|
||||
|
||||
@@ -167,9 +167,9 @@ void DashboardItemInputState::render(glm::vec2& penPosition) {
|
||||
}
|
||||
|
||||
if (!text.empty()) {
|
||||
penPosition.y -= _font->height();
|
||||
const std::string t = ghoul::join(std::move(text), "\n");
|
||||
RenderFont(*_font, penPosition, t);
|
||||
penPosition.y -= _font->height();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,13 +84,7 @@ void DashboardItemMission::render(glm::vec2& penPosition) {
|
||||
static constexpr glm::vec4 nonCurrentMissionColor = glm::vec4(0.3f, 0.3f, 0.3f, 1.f);
|
||||
|
||||
// Add spacing
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
" ",
|
||||
nonCurrentMissionColor,
|
||||
ghoul::fontrendering::CrDirection::Down
|
||||
);
|
||||
penPosition.y -= _font->height();
|
||||
|
||||
MissionPhase::Trace phaseTrace = mission.phaseTrace(currentTime);
|
||||
if (!phaseTrace.empty()) {
|
||||
@@ -179,6 +173,8 @@ void DashboardItemMission::render(glm::vec2& penPosition) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
penPosition.y += _font->height();
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemMission::size() const {
|
||||
|
||||
@@ -100,8 +100,8 @@ void DashboardItemParallelConnection::render(glm::vec2& penPosition) {
|
||||
}
|
||||
|
||||
if (!connectionInfo.empty()) {
|
||||
RenderFont(*_font, penPosition, connectionInfo);
|
||||
penPosition.y -= _font->height() * nLines;
|
||||
RenderFont(*_font, penPosition, connectionInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -115,214 +115,213 @@ void DashboardItemPropertyValue::render(glm::vec2& penPosition) {
|
||||
_propertyIsDirty = false;
|
||||
}
|
||||
|
||||
if (_property) {
|
||||
const std::string_view type = _property->className();
|
||||
if (type == "DoubleProperty") {
|
||||
double value = static_cast<properties::DoubleProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "FloatProperty") {
|
||||
float value = static_cast<properties::FloatProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "IntProperty") {
|
||||
int value = static_cast<properties::IntProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "LongProperty") {
|
||||
long value = static_cast<properties::LongProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "ShortProperty") {
|
||||
short value = static_cast<properties::ShortProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "UIntProperty") {
|
||||
unsigned int v = static_cast<properties::UIntProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v))
|
||||
);
|
||||
}
|
||||
else if (type == "ULongProperty") {
|
||||
unsigned long v = static_cast<properties::ULongProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v))
|
||||
);
|
||||
}
|
||||
else if (type == "UShortProperty") {
|
||||
unsigned short v =
|
||||
static_cast<properties::UShortProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v))
|
||||
);
|
||||
}
|
||||
else if (type == "DVec2Property") {
|
||||
glm::dvec2 v = static_cast<properties::DVec2Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y))
|
||||
);
|
||||
}
|
||||
else if (type == "DVec3Property") {
|
||||
glm::dvec3 v = static_cast<properties::DVec3Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y, v.z))
|
||||
);
|
||||
}
|
||||
else if (type == "DVec4Property") {
|
||||
glm::dvec4 v = static_cast<properties::DVec4Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(
|
||||
_displayString.value(),
|
||||
std::make_format_args(v.x, v.y, v.z, v.w)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (type == "IVec2Property") {
|
||||
glm::ivec2 v = static_cast<properties::IVec2Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y))
|
||||
);
|
||||
}
|
||||
else if (type == "IVec3Property") {
|
||||
glm::ivec3 v = static_cast<properties::IVec3Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y, v.z))
|
||||
);
|
||||
}
|
||||
else if (type == "IVec4Property") {
|
||||
glm::ivec4 v = static_cast<properties::IVec4Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(
|
||||
_displayString.value(),
|
||||
std::make_format_args(v.x, v.y, v.z, v.w)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (type == "UVec2Property") {
|
||||
glm::uvec2 v = static_cast<properties::UVec2Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y))
|
||||
);
|
||||
}
|
||||
else if (type == "UVec3Property") {
|
||||
glm::uvec3 v = static_cast<properties::UVec3Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y, v.z))
|
||||
);
|
||||
}
|
||||
else if (type == "UVec4Property") {
|
||||
glm::uvec4 v = static_cast<properties::UVec4Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(
|
||||
_displayString.value(),
|
||||
std::make_format_args(v.x, v.y, v.z, v.w)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (type == "Vec2Property") {
|
||||
glm::vec2 v = static_cast<properties::Vec2Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y))
|
||||
);
|
||||
}
|
||||
else if (type == "Vec3Property") {
|
||||
glm::vec3 v = static_cast<properties::Vec3Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y, v.z))
|
||||
);
|
||||
}
|
||||
else if (type == "Vec4Property") {
|
||||
glm::vec4 v = static_cast<properties::Vec4Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(
|
||||
_displayString.value(),
|
||||
std::make_format_args(v.x, v.y, v.z, v.w)
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
// Fallback if we don't have a special case above
|
||||
if (!_property) {
|
||||
return;
|
||||
}
|
||||
const std::string_view type = _property->className();
|
||||
penPosition.y -= _font->height();
|
||||
if (type == "DoubleProperty") {
|
||||
double value = static_cast<properties::DoubleProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "FloatProperty") {
|
||||
float value = static_cast<properties::FloatProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "IntProperty") {
|
||||
int value = static_cast<properties::IntProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "LongProperty") {
|
||||
long value = static_cast<properties::LongProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "ShortProperty") {
|
||||
short value = static_cast<properties::ShortProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
else if (type == "UIntProperty") {
|
||||
unsigned int v = static_cast<properties::UIntProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v))
|
||||
);
|
||||
}
|
||||
else if (type == "ULongProperty") {
|
||||
unsigned long v = static_cast<properties::ULongProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v))
|
||||
);
|
||||
}
|
||||
else if (type == "UShortProperty") {
|
||||
unsigned short v = static_cast<properties::UShortProperty*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v))
|
||||
);
|
||||
}
|
||||
else if (type == "DVec2Property") {
|
||||
glm::dvec2 v = static_cast<properties::DVec2Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y))
|
||||
);
|
||||
}
|
||||
else if (type == "DVec3Property") {
|
||||
glm::dvec3 v = static_cast<properties::DVec3Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y, v.z))
|
||||
);
|
||||
}
|
||||
else if (type == "DVec4Property") {
|
||||
glm::dvec4 v = static_cast<properties::DVec4Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(
|
||||
_displayString.value(),
|
||||
std::make_format_args(v.x, v.y, v.z, v.w)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (type == "IVec2Property") {
|
||||
glm::ivec2 v = static_cast<properties::IVec2Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y))
|
||||
);
|
||||
}
|
||||
else if (type == "IVec3Property") {
|
||||
glm::ivec3 v = static_cast<properties::IVec3Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y, v.z))
|
||||
);
|
||||
}
|
||||
else if (type == "IVec4Property") {
|
||||
glm::ivec4 v = static_cast<properties::IVec4Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(
|
||||
_displayString.value(),
|
||||
std::make_format_args(v.x, v.y, v.z, v.w)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (type == "UVec2Property") {
|
||||
glm::uvec2 v = static_cast<properties::UVec2Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y))
|
||||
);
|
||||
}
|
||||
else if (type == "UVec3Property") {
|
||||
glm::uvec3 v = static_cast<properties::UVec3Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y, v.z))
|
||||
);
|
||||
}
|
||||
else if (type == "UVec4Property") {
|
||||
glm::uvec4 v = static_cast<properties::UVec4Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(
|
||||
_displayString.value(),
|
||||
std::make_format_args(v.x, v.y, v.z, v.w)
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (type == "Vec2Property") {
|
||||
glm::vec2 v = static_cast<properties::Vec2Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y))
|
||||
);
|
||||
}
|
||||
else if (type == "Vec3Property") {
|
||||
glm::vec3 v = static_cast<properties::Vec3Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(v.x, v.y, v.z))
|
||||
);
|
||||
}
|
||||
else if (type == "Vec4Property") {
|
||||
glm::vec4 v = static_cast<properties::Vec4Property*>(_property)->value();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(
|
||||
_displayString.value(),
|
||||
std::make_format_args(v.x, v.y, v.z, v.w)
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
// Fallback if we don't have a special case above
|
||||
|
||||
std::string value = _property->stringValue();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
|
||||
penPosition.y -= _font->height();
|
||||
std::string value = _property->stringValue();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
// @CPP26(abock): This can be replaced with std::runtime_format
|
||||
std::vformat(_displayString.value(), std::make_format_args(value))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +188,7 @@ void DashboardItemSimulationIncrement::render(glm::vec2& penPosition) {
|
||||
std::string pauseText = global::timeManager->isPaused() ? " (Paused)" : "";
|
||||
|
||||
try {
|
||||
penPosition.y -= _font->height();
|
||||
if (targetDt != currentDt && !global::timeManager->isPaused()) {
|
||||
// We are in the middle of a transition
|
||||
RenderFont(
|
||||
@@ -223,7 +224,6 @@ void DashboardItemSimulationIncrement::render(glm::vec2& penPosition) {
|
||||
catch (const std::format_error&) {
|
||||
LERRORC("DashboardItemDate", "Illegal format string");
|
||||
}
|
||||
penPosition.y -= _font->height();
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemSimulationIncrement::size() const {
|
||||
|
||||
@@ -69,8 +69,8 @@ DashboardItemText::DashboardItemText(const ghoul::Dictionary& dictionary)
|
||||
void DashboardItemText::render(glm::vec2& penPosition) {
|
||||
ZoneScoped;
|
||||
|
||||
RenderFont(*_font, penPosition, _text.value());
|
||||
penPosition.y -= _font->height();
|
||||
RenderFont(*_font, penPosition, _text.value());
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemText::size() const {
|
||||
|
||||
@@ -142,12 +142,12 @@ void DashboardItemVelocity::render(glm::vec2& penPosition) {
|
||||
dist = std::pair(convertedD, nameForDistanceUnit(unit, convertedD != 1.0));
|
||||
}
|
||||
|
||||
penPosition.y -= _font->height();
|
||||
RenderFont(
|
||||
*_font,
|
||||
penPosition,
|
||||
std::format("Camera velocity: {:.4f} {}/s", dist.first, dist.second)
|
||||
);
|
||||
penPosition.y -= _font->height();
|
||||
|
||||
_prevPosition = currentPos;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ bool ScreenSpaceDashboard::initializeGL() {
|
||||
ScreenSpaceFramebuffer::initializeGL();
|
||||
|
||||
addRenderFunction([this]() {
|
||||
glm::vec2 penPosition = glm::vec2(10.f, _size.value().w);
|
||||
glm::vec2 penPosition = glm::vec2(0.f, _size.value().w);
|
||||
|
||||
if (_useMainDashboard) {
|
||||
global::dashboard->render(penPosition);
|
||||
|
||||
@@ -201,9 +201,9 @@ void DashboardItemGlobeLocation::render(glm::vec2& penPosition) {
|
||||
}
|
||||
}
|
||||
|
||||
penPosition.y -= _font->height();
|
||||
const std::string_view text = std::string_view(_buffer.data(), end - _buffer.data());
|
||||
RenderFont(*_font, penPosition, text);
|
||||
penPosition.y -= _font->height();
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemGlobeLocation::size() const {
|
||||
|
||||
@@ -127,7 +127,7 @@ void DashboardItemInstruments::render(glm::vec2& penPosition) {
|
||||
}
|
||||
ImageSequencer& sequencer = ImageSequencer::ref();
|
||||
|
||||
penPosition.y -= 25.f;
|
||||
penPosition.y -= _font->height();
|
||||
|
||||
constexpr glm::vec4 targetColor(0.f, 0.75f, 1.f, 1.f);
|
||||
|
||||
@@ -248,6 +248,10 @@ void DashboardItemInstruments::render(glm::vec2& penPosition) {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// The last item added a CR but we want to undo it since it's the next item's
|
||||
// responsibility to move down
|
||||
penPosition.y += _font->height();
|
||||
}
|
||||
|
||||
glm::vec2 DashboardItemInstruments::size() const {
|
||||
|
||||
@@ -56,9 +56,7 @@ namespace openspace {
|
||||
Dashboard::Dashboard()
|
||||
: properties::PropertyOwner({ "Dashboard" })
|
||||
, _isEnabled(EnabledInfo, true)
|
||||
, _startPositionOffset(
|
||||
properties::IVec2Property(StartPositionOffsetInfo, glm::ivec2(10, -25))
|
||||
)
|
||||
, _startPositionOffset(StartPositionOffsetInfo, glm::ivec2(10, -10))
|
||||
{
|
||||
addProperty(_isEnabled);
|
||||
addProperty(_startPositionOffset);
|
||||
|
||||
Reference in New Issue
Block a user