Reformat code to have non GL interface
This commit is contained in:
parent
af734cda73
commit
9ec93964ba
34 changed files with 644 additions and 362 deletions
|
|
@ -1,6 +1,6 @@
|
|||
#include <iostream>
|
||||
|
||||
#include "uui/opengl/uui.hpp"
|
||||
#include "uui/uui.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
@ -10,92 +10,92 @@ int main()
|
|||
{
|
||||
cout << "Starting example 1" << endl;
|
||||
{
|
||||
uui::GlApplication app;
|
||||
// uui::GlApplication app2; // exception : application already created
|
||||
app.create_window(800, 600, "OpenGl!", [](uui::GlWindow& window) {
|
||||
window.create_component(0, 100, 0.5f, 50, [](uui::GlComponent& component) {
|
||||
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::GlComponent& component) {
|
||||
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::GlLabel& label) {
|
||||
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::GlLabel& label) {
|
||||
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::GlFlex& flex) {
|
||||
flex.create_component(100, 50, [](uui::GlComponent& component) {
|
||||
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::GlComponent& component) {
|
||||
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::GlFlex& flex) {
|
||||
flex.create_component(50, 100, [](uui::GlComponent& component) {
|
||||
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::GlComponent& component) {
|
||||
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::GlWindow& window) {
|
||||
window.create_stack(200, 0.6f, uui::Direction::HORIZONTAL, [](uui::GlStack& stack) {
|
||||
stack.create_component(100, 50, [](uui::GlComponent& component) {
|
||||
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::GlComponent& component) {
|
||||
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::GlStack& stack) {
|
||||
stack.create_component(100, 50, [](uui::GlComponent& component) {
|
||||
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::GlComponent& component) {
|
||||
stack.create_component(100, 20, [](uui::Component& component) {
|
||||
component.set_background_color(0.2f, 0.25f, 0.75f);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
app.run();
|
||||
app->run();
|
||||
}
|
||||
cout << "\nStarting example 2" << endl;
|
||||
{
|
||||
uui::GlApplication app;
|
||||
app.create_window(800, 600, "OpenGl!", [](uui::GlWindow& window) {
|
||||
window.create_component(0.25f, 0.25f, 0.5f, 0.5f, [](uui::GlComponent& component) {
|
||||
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::GlComponent& component) {
|
||||
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::GlWindow& window) {
|
||||
window.create_component(0, 0.5f, 100, 0.5f, [](uui::GlComponent& component) {
|
||||
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::GlLabel& label) {
|
||||
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();
|
||||
app->run();
|
||||
}
|
||||
}
|
||||
catch(const std::exception& error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue