Balling out info page.

This commit is contained in:
2025-05-04 07:24:29 -05:00
parent 89f46b6f5a
commit 5bac78e168
2 changed files with 81 additions and 23 deletions

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 161 KiB

104
main.cpp
View File

@@ -14,6 +14,9 @@
#include "JUI/Widgets/UtilityBar.hpp" #include "JUI/Widgets/UtilityBar.hpp"
#include <JUI/Widgets/ColorPicker.hpp> #include <JUI/Widgets/ColorPicker.hpp>
#include "JUI/Widgets/Image.hpp"
#include "JUI/Widgets/ImageRect.hpp"
std::vector<std::string> string_expand(const std::string& input, char delimiter = ' '); std::vector<std::string> string_expand(const std::string& input, char delimiter = ' ');
@@ -148,6 +151,74 @@ public:
juliaset_dialog->Close(); juliaset_dialog->Close();
} }
JUI::Window* CreateAppInfoDialogWindow(JUI::Widget* parent) {
// TODO: Implement JUI structure that makes blocks of text easy to impelement.
auto window = new JUI::Window(parent);
window->SetTitle("About FractalInspector");
window->Size({300_px, 375_px});
window->MinSize({300, 375});
auto* layout = new JUI::VerticalListLayout(window->Content());
layout->Padding(0_px);
// TODO: Code like this ends up being a common construct in JUI programs: Make a TextList widget.
auto line_item = [&] (const std::string& text, int size = 20, const Color4& color = Colors::White) {
auto* content = new JUI::TextRect(layout);
content->Size({100_percent, JUI::UDim(size+5, 0)});
content->SetContent(text);
content->SetTextSize(size);
content->SetTextColor(color);
content->BGColor(Colors::Transparent);
content->AlignCenterHorizontally();
content->BorderWidth(0);
};
line_item("FractalInspector", 30);
line_item("Version 1.0", 14);
auto* box = new JUI::Rect(layout);
box->Size({100_percent, 200_px});
box->BGColor(Colors::Transparent);
box->BorderWidth(0);
auto* img = new JUI::ImageRect(box);
img->Content(new JGL::Texture("../icon.png"));
img->Size({200_px, 200_px});
img->BGColor(Colors::Transparent);
img->AnchorPoint({.5f, .5f});
img->Position({50_percent, 50_percent});
img->BorderWidth(0);
img->BGColor(Colors::Transparent);
line_item("Developed & Maintained by Josh O'Leary.", 16);
line_item("William R. Maxine H. Ash B.", 12);
line_item("(c) 2024 - 2025 Redacted Software", 16);
auto* btn_box = new JUI::Rect(layout);
btn_box->Size({100_percent, 40_px});
btn_box->BGColor(Colors::Transparent);
btn_box->BorderWidth(0);
auto* btn_layout = new JUI::HorizontalListLayout(btn_box);
btn_layout->Padding(8_px);
auto btn_item = [&] (const std::string& text) -> JUI::TextButton* {
JUI::TextButton* btn = new JUI::TextButton(btn_layout);
btn->SetContent(text);
btn->Size({32_percent, 100_percent});
btn->SetTextColor(Colors::Black);
btn->Center();
return btn;
};
auto* btn_a = btn_item("License");
auto* btn_b = btn_item("Wiki");
auto* btn_c = btn_item("Source");
return window;
}
void CreateMenu() { void CreateMenu() {
using namespace JUI::UDimLiterals; using namespace JUI::UDimLiterals;
@@ -163,6 +234,8 @@ public:
current_fractal = Fractal::JuliaSet; current_fractal = Fractal::JuliaSet;
}); });
auto* view = toolbar->AddSubmenu("View"); { auto* view = toolbar->AddSubmenu("View"); {
view->AddButton("Color Picker Dialog", [this] { view->AddButton("Color Picker Dialog", [this] {
colorpicker_window->Toggle(); colorpicker_window->Toggle();
@@ -190,9 +263,14 @@ public:
auto* btn_toggle_info_dialog = toolbar->AddButton("Info"); auto* btn_toggle_info_dialog = toolbar->AddButton("Info");
// TODO: Implement JUI structure that makes blocks of text easy to impelement. auto* misc = toolbar->AddSubmenu("Miscellaneous");
info_dialog = new JUI::Window(scene); {
info_dialog->SetTitle("FractalInspector - Read Me"); misc->AddButton("Take Screenshot");
misc->AddButton("Take Collage");
}
info_dialog = CreateAppInfoDialogWindow(scene);
btn_toggle_info_dialog->OnClickEvent += [this] (auto a, auto b) mutable { btn_toggle_info_dialog->OnClickEvent += [this] (auto a, auto b) mutable {
info_dialog->Toggle(); info_dialog->Toggle();
@@ -204,28 +282,8 @@ public:
fps_label->SetTextColor(Colors::Black); fps_label->SetTextColor(Colors::Black);
fps_label->SetContent("60 FPS"); fps_label->SetContent("60 FPS");
auto* layout = new JUI::VerticalListLayout(info_dialog->ViewportInstance());
layout->Padding(0_px);
// TODO: Code like this ends up being a common construct in JUI programs: Make a TextList widget.
auto line_item = [&] (const std::string& text, int size = 20, const Color4& color = Colors::White) {
auto* content = new JUI::TextRect(layout);
content->Size({100_percent, 25_px});
content->SetContent(text);
content->SetTextSize(size);
content->SetTextColor(color);
content->BGColor(Colors::Transparent);
content->AlignCenterHorizontally();
};
// TODO: Is this text useful and relevant, or does it come off as egotistic autofellatio?
line_item("FractalInspector V 1.0");
line_item("Developed & Maintained by Josh O'Leary");
line_item("(c) 2025 Redacted Software - redacted.cc");
line_item("This project is part of an independent research project to develop high-performance,", 18);
line_item("useful software that stands in contrast to all modern software trends.", 18);
line_item("This program is written in C++, from scratch.");
// TODO: Utilize for things later. // TODO: Utilize for things later.
colorpicker_window = new JUI::Window(scene); colorpicker_window = new JUI::Window(scene);