#include #include "uui/uui.hpp" using namespace std; int main() { try { cout << "Starting example 1" << endl; { auto app = uui::create_application(uui::Application::OPENGL); // auto app2 = uui::create_application(uui::Application::OPENGL); // exception : application already created app->create_window(800, 600, "OpenGl!", [](uui::Window& window) { window.create_component(0, 100, 0.5f, 50, [](uui::Component& component) { component.set_background_color(0.8f, 0.1f, 0.5f); }); window.create_component(0.25f, 50, 0.4f, 150, [](uui::Component& component) { component.set_background_color(0.3f, 0.8f, 0.4f, 0.5f); }); window.create_label(50, 50, "Hello World!", {0.5f, 1.0f, 0.5f, 1.0f}, [](uui::Label& label) { label.set_background_color(0.1f, 0.2f, 0.5f, 0.8f); }); window.create_label(0.5f, 0.5f, "Hello World!", {1.0f, 1.0f, 1.0f, 0.5f}, [](uui::Label& label) { label.set_background_color(0.5f, 0.5f, 0.1f); }); window.create_label(0.75f, 0.75f, "Hello World!", {1.0f, 1.0f, 1.0f, 0.1f}, {}); window.create_flex(200, 0.6f, uui::Direction::HORIZONTAL, [](uui::Flex& flex) { flex.create_component( 100, 50, [](uui::Component& component) { component.set_background_color(0.2f, 0.75f, 0.25f); }); flex.create_label("test", {0.8f, 0.2f, 0.2f, 1.0f}, {}); flex.create_component( 100, 20, [](uui::Component& component) { component.set_background_color(0.2f, 0.25f, 0.75f); }); }); window.create_flex(50, 400, uui::Direction::VERTICAL, [](uui::Flex& flex) { flex.create_component( 50, 100, [](uui::Component& component) { component.set_background_color(0.2f, 0.75f, 0.25f); }); flex.create_label("test", {0.8f, 0.2f, 0.2f, 1.0f}, {}); flex.create_component( 100, 20, [](uui::Component& component) { component.set_background_color(0.2f, 0.25f, 0.75f); }); }); }); app->create_window(800, 600, "OpenGl 2", [](uui::Window& window) { window.create_stack(200, 0.6f, uui::Direction::HORIZONTAL, [](uui::Stack& stack) { stack.create_component( 100, 50, [](uui::Component& component) { component.set_background_color(0.2f, 0.75f, 0.25f); }); stack.create_label("test", {0.8f, 0.2f, 0.2f, 1.0f}, {}); stack.create_component( 100, 20, [](uui::Component& component) { component.set_background_color(0.2f, 0.25f, 0.75f); }); }); window.create_stack(50, 400, uui::Direction::VERTICAL, [](uui::Stack& stack) { stack.create_component( 100, 50, [](uui::Component& component) { component.set_background_color(0.2f, 0.75f, 0.25f); }); stack.create_label("test", {0.8f, 0.2f, 0.2f, 1.0f}, {}); stack.create_component( 100, 20, [](uui::Component& component) { component.set_background_color(0.2f, 0.25f, 0.75f); }); }); }); app->run(); } cout << "\nStarting example 2" << endl; { auto app = uui::create_application(uui::Application::OPENGL); app->create_window(800, 600, "OpenGl!", [](uui::Window& window) { window.create_component(0.25f, 0.25f, 0.5f, 0.5f, [](uui::Component& component) { component.set_background_color(0.8f, 0.1f, 0.5f); }); window.create_component(0.75f, 0.75f, 0.25f, 0.25f, [](uui::Component& component) { component.set_background_color(0.2f, 0.1f, 0.5f); }); }); app->create_window(600, 600, "OpenGL 2!", [](uui::Window& window) { window.create_component(0, 0.5f, 100, 0.5f, [](uui::Component& component) { component.set_background_color(0.2f, 0.5f, 0.3f); }); window.create_label(50, 50, "Hello World!", {0.5f, 1.0f, 0.5f, 1.0f}, [](uui::Label& label) { label.set_background_color(0.1f, 0.2f, 0.5f); }); }); app->run(); } } catch(const std::exception& error) { std::cerr << error.what() << std::endl; return EXIT_FAILURE; } cout << "Example done" << endl; return 0; }