summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Belt <andrewpbelt@gmail.com>2022-12-19 19:16:35 -0500
committerAndrew Belt <andrewpbelt@gmail.com>2022-12-19 19:16:35 -0500
commit8f432d536b0057c08316d5c75f94043c40cf46ff (patch)
tree72b0e7f9a69d8f631e10686af2e7eb8048742497
parentb8708cb73c63fe136af7eb94715982ede219fbf0 (diff)
Move app name, version, and arch from Help menu to menu bar.
-rw-r--r--src/app/MenuBar.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/src/app/MenuBar.cpp b/src/app/MenuBar.cpp
index 84e2b44f..4d86a454 100644
--- a/src/app/MenuBar.cpp
+++ b/src/app/MenuBar.cpp
@@ -842,10 +842,6 @@ struct HelpButton : MenuButton {
menu->addChild(new ui::MenuSeparator);
- menu->addChild(createMenuLabel(APP_NAME + " " + APP_EDITION_NAME + " " + APP_VERSION));
-
- menu->addChild(createMenuLabel(APP_OS_NAME + " " + APP_CPU_NAME));
-
menu->addChild(createMenuItem("Open user folder", "", [=]() {
system::openDirectory(asset::user(""));
}));
@@ -882,7 +878,7 @@ struct HelpButton : MenuButton {
////////////////////
-struct MeterLabel : ui::Label {
+struct InfoLabel : ui::Label {
int frameCount = 0;
double frameDurationTotal = 0.0;
double frameDurationAvg = NAN;
@@ -913,17 +909,25 @@ struct MeterLabel : ui::Label {
// uiLastTime = time;
// }
- double fps = std::isfinite(frameDurationAvg) ? 1.0 / frameDurationAvg : 0.0;
- double meterAverage = APP->engine->getMeterAverage();
- double meterMax = APP->engine->getMeterMax();
- text = string::f("%.1f fps %.1f%% avg %.1f%% max", fps, meterAverage * 100, meterMax * 100);
+ text = "";
+
+ if (box.size.x >= 460) {
+ double fps = std::isfinite(frameDurationAvg) ? 1.0 / frameDurationAvg : 0.0;
+ double meterAverage = APP->engine->getMeterAverage();
+ double meterMax = APP->engine->getMeterMax();
+ text += string::f("%.1f fps %.1f%% avg %.1f%% max", fps, meterAverage * 100, meterMax * 100);
+ text += " ";
+ }
+
+ text += APP_NAME + " " + APP_EDITION_NAME + " " + APP_VERSION + " " + APP_OS_NAME + " " + APP_CPU_NAME;
+
Label::step();
}
};
struct MenuBar : widget::OpaqueWidget {
- MeterLabel* meterLabel;
+ InfoLabel* infoLabel;
MenuBar() {
const float margin = 5;
@@ -958,16 +962,11 @@ struct MenuBar : widget::OpaqueWidget {
helpButton->text = "Help";
layout->addChild(helpButton);
- // ui::Label* titleLabel = new ui::Label;
- // titleLabel->color.a = 0.5;
- // layout->addChild(titleLabel);
-
- meterLabel = new MeterLabel;
- meterLabel->box.pos.y = margin;
- meterLabel->box.size.x = 300;
- meterLabel->alignment = ui::Label::RIGHT_ALIGNMENT;
- meterLabel->color.a = 0.5;
- addChild(meterLabel);
+ infoLabel = new InfoLabel;
+ infoLabel->box.size.x = 600;
+ infoLabel->alignment = ui::Label::RIGHT_ALIGNMENT;
+ infoLabel->color.a = 0.5;
+ layout->addChild(infoLabel);
}
void draw(const DrawArgs& args) override {
@@ -978,8 +977,8 @@ struct MenuBar : widget::OpaqueWidget {
}
void step() override {
- meterLabel->box.pos.x = box.size.x - meterLabel->box.size.x - 5;
Widget::step();
+ infoLabel->box.size.x = box.size.x - infoLabel->box.pos.x - 5;
}
};