diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..466f842 Binary files /dev/null and b/icon.png differ diff --git a/main.cpp b/main.cpp index c51e636..b10359b 100644 --- a/main.cpp +++ b/main.cpp @@ -14,6 +14,9 @@ #include "JUI/Widgets/UtilityBar.hpp" #include +#include "JUI/Widgets/Image.hpp" +#include "JUI/Widgets/ImageRect.hpp" + std::vector string_expand(const std::string& input, char delimiter = ' '); @@ -148,6 +151,74 @@ public: 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() { using namespace JUI::UDimLiterals; @@ -163,6 +234,8 @@ public: current_fractal = Fractal::JuliaSet; }); + + auto* view = toolbar->AddSubmenu("View"); { view->AddButton("Color Picker Dialog", [this] { colorpicker_window->Toggle(); @@ -190,9 +263,14 @@ public: auto* btn_toggle_info_dialog = toolbar->AddButton("Info"); - // TODO: Implement JUI structure that makes blocks of text easy to impelement. - info_dialog = new JUI::Window(scene); - info_dialog->SetTitle("FractalInspector - Read Me"); + auto* misc = toolbar->AddSubmenu("Miscellaneous"); + { + misc->AddButton("Take Screenshot"); + misc->AddButton("Take Collage"); + } + + + info_dialog = CreateAppInfoDialogWindow(scene); btn_toggle_info_dialog->OnClickEvent += [this] (auto a, auto b) mutable { info_dialog->Toggle(); @@ -204,28 +282,8 @@ public: fps_label->SetTextColor(Colors::Black); 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. colorpicker_window = new JUI::Window(scene);