Adding Info Dialog, and standard UI controls.
This commit is contained in:
73
main.cpp
73
main.cpp
@@ -9,6 +9,8 @@
|
||||
#include <ReWindow/Logger.h>
|
||||
#include <Color4.hpp>
|
||||
|
||||
#include "JUI/Widgets/UtilityBar.hpp"
|
||||
|
||||
std::vector<std::string> string_expand(const std::string& input, char delimiter = ' ');
|
||||
|
||||
|
||||
@@ -113,6 +115,8 @@ public:
|
||||
bri_label->SetTextColor(Colors::Black);
|
||||
bri_label->SetContent("Brightness: 100%");
|
||||
|
||||
|
||||
|
||||
auto* hue_box = new JUI::Rect();
|
||||
}
|
||||
|
||||
@@ -133,7 +137,9 @@ private:
|
||||
class ReShaderProgram : public ReWindow::OpenGLWindow {
|
||||
public:
|
||||
JUI::Scene *scene;
|
||||
JUI::UtilityBar* toolbar;
|
||||
JUI::CommandLine *console;
|
||||
JUI::Window* info_dialog;
|
||||
JGL::Shader shader;
|
||||
JGL::RenderTarget *canvas;
|
||||
float u_time;
|
||||
@@ -144,19 +150,7 @@ public:
|
||||
std::string frag_name;
|
||||
std::string vert_name;
|
||||
|
||||
ReShaderProgram() : ReWindow::OpenGLWindow("ReShader", 1080, 720, 2, 1) {
|
||||
Shader::OnCompilationErrorMessage += [this](std::string type, std::string infoLog) {
|
||||
auto log_lines = string_expand(infoLog, '\n');
|
||||
console->Log(type, Colors::Red);
|
||||
std::cerr << type << std::endl;
|
||||
for (auto line: log_lines) {
|
||||
console->Log(line, Colors::Red);
|
||||
std::cerr << line << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
u_time = 0;
|
||||
}
|
||||
ReShaderProgram();
|
||||
|
||||
static std::filesystem::path VertexShaderFilepathFromPrefixName(const std::string &name)
|
||||
{
|
||||
@@ -208,9 +202,48 @@ public:
|
||||
console->Log(std::format("{}", args.size()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateMenu() {
|
||||
using namespace JUI::UDimLiterals;
|
||||
|
||||
toolbar = new JUI::UtilityBar(scene);
|
||||
toolbar->AddSubmenu("File"); toolbar->AddSubmenu("Edit");
|
||||
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");
|
||||
|
||||
btn_toggle_info_dialog->OnClickEvent += [this] (auto a, auto b) mutable {
|
||||
info_dialog->Toggle();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
auto* layout = new JUI::VerticalListLayout(info_dialog->ViewportInstance());
|
||||
layout->Padding(0_px);
|
||||
|
||||
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.
|
||||
auto* wind = new JUI::Window(scene);
|
||||
wind->SetTitle("Color-Picker A");
|
||||
@@ -455,6 +488,20 @@ protected:
|
||||
private:
|
||||
};
|
||||
|
||||
ReShaderProgram::ReShaderProgram(): ReWindow::OpenGLWindow("ReShader", 1080, 720, 2, 1) {
|
||||
Shader::OnCompilationErrorMessage += [this](std::string type, std::string infoLog) {
|
||||
auto log_lines = string_expand(infoLog, '\n');
|
||||
console->Log(type, Colors::Red);
|
||||
std::cerr << type << std::endl;
|
||||
for (auto line: log_lines) {
|
||||
console->Log(line, Colors::Red);
|
||||
std::cerr << line << std::endl;
|
||||
}
|
||||
};
|
||||
|
||||
u_time = 0;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
ReWindow::Logger::Debug.EnableConsole(false);
|
||||
|
||||
|
Reference in New Issue
Block a user