Code cleaning, update roadmap and manifest
This commit is contained in:
parent
9ec93964ba
commit
73934d0e34
20 changed files with 56 additions and 76 deletions
10
ROADMAP.md
10
ROADMAP.md
|
|
@ -1,16 +1,16 @@
|
||||||
* layout
|
|
||||||
|
|
||||||
* button
|
* button
|
||||||
|
|
||||||
* lambda constructor
|
|
||||||
|
|
||||||
* scroll
|
* scroll
|
||||||
|
|
||||||
* Text wrap
|
* Text wrap
|
||||||
|
|
||||||
|
* Style
|
||||||
|
|
||||||
|
* Text Edition
|
||||||
|
|
||||||
* projected vertex/raw vertex mode (projection on GPU)
|
* projected vertex/raw vertex mode (projection on GPU)
|
||||||
|
|
||||||
* negative absolution position (from right/bottom)
|
* negative absolute position (from right/bottom)
|
||||||
|
|
||||||
* VAO/VBO in windows (batched)
|
* VAO/VBO in windows (batched)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "uui/config.hpp"
|
#include "uui/types.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
{
|
{
|
||||||
|
|
@ -11,6 +11,11 @@ class Window;
|
||||||
class Application
|
class Application
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
#ifdef DEBUG
|
||||||
|
constexpr static bool debug_mode = true;
|
||||||
|
#else
|
||||||
|
constexpr static bool debug_mode = false;
|
||||||
|
#endif
|
||||||
enum Implementaion
|
enum Implementaion
|
||||||
{
|
{
|
||||||
OPENGL
|
OPENGL
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "uui/config.hpp"
|
#include "uui/types.hpp"
|
||||||
#include "uui/window.hpp"
|
#include "uui/window.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
|
|
@ -15,12 +15,6 @@ public:
|
||||||
virtual void set_background_color(float r, float g, float b, float a = 1.0f) = 0;
|
virtual void set_background_color(float r, float g, float b, float a = 1.0f) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef DEBUG
|
|
||||||
constexpr static bool debug_mode = true;
|
|
||||||
#else
|
|
||||||
constexpr static bool debug_mode = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::shared_ptr<Window> window;
|
std::shared_ptr<Window> window;
|
||||||
std::size_t window_index;
|
std::size_t window_index;
|
||||||
std::shared_ptr<Container> parent;
|
std::shared_ptr<Container> parent;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "uui/config.hpp"
|
#include "uui/types.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
{
|
{
|
||||||
|
|
@ -15,6 +15,7 @@ class GlComponent;
|
||||||
class Container
|
class Container
|
||||||
{
|
{
|
||||||
friend class GlComponent;
|
friend class GlComponent;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum Type
|
enum Type
|
||||||
{
|
{
|
||||||
|
|
@ -26,11 +27,6 @@ public:
|
||||||
Type type;
|
Type type;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef DEBUG
|
|
||||||
constexpr static bool debug_mode = true;
|
|
||||||
#else
|
|
||||||
constexpr static bool debug_mode = false;
|
|
||||||
#endif
|
|
||||||
virtual std::size_t push_child(std::shared_ptr<Component> child) = 0;
|
virtual std::size_t push_child(std::shared_ptr<Component> child) = 0;
|
||||||
virtual std::shared_ptr<Component> get_child(std::size_t index) const = 0;
|
virtual std::shared_ptr<Component> get_child(std::size_t index) const = 0;
|
||||||
virtual void remove_child(std::size_t index) = 0;
|
virtual void remove_child(std::size_t index) = 0;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include "graphic_context.hpp"
|
#include "graphic_context.hpp"
|
||||||
#include "uui/application.hpp"
|
#include "uui/application.hpp"
|
||||||
#include "uui/config.hpp"
|
#include "uui/types.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
{
|
{
|
||||||
|
|
@ -16,11 +16,6 @@ class GlApplication final: virtual public Application
|
||||||
friend class GlWindow;
|
friend class GlWindow;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifdef DEBUG
|
|
||||||
constexpr static bool debug_mode = true;
|
|
||||||
#else
|
|
||||||
constexpr static bool debug_mode = false;
|
|
||||||
#endif
|
|
||||||
std::vector<std::shared_ptr<GlWindow>> windows;
|
std::vector<std::shared_ptr<GlWindow>> windows;
|
||||||
|
|
||||||
GlApplication();
|
GlApplication();
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "graphic_context.hpp"
|
#include "graphic_context.hpp"
|
||||||
#include "uui/opengl/component.hpp"
|
|
||||||
#include "uui/container.hpp"
|
#include "uui/container.hpp"
|
||||||
#include "uui/config.hpp"
|
#include "uui/opengl/component.hpp"
|
||||||
#include "uui/opengl/window.hpp"
|
#include "uui/opengl/window.hpp"
|
||||||
|
#include "uui/types.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
{
|
{
|
||||||
|
|
@ -39,7 +39,8 @@ protected:
|
||||||
GlComponent(
|
GlComponent(
|
||||||
std::shared_ptr<GlWindow> window, std::size_t window_index, const position_t x, const position_t y,
|
std::shared_ptr<GlWindow> window, std::size_t window_index, const position_t x, const position_t y,
|
||||||
const position_t width, const position_t height):
|
const position_t width, const position_t height):
|
||||||
GlComponent(window, window_index, std::static_pointer_cast<GlContainer>(window), window_index, x, y, width, height)
|
GlComponent(
|
||||||
|
window, window_index, std::static_pointer_cast<GlContainer>(window), window_index, x, y, width, height)
|
||||||
{}
|
{}
|
||||||
GlComponent(const GlComponent&) = delete;
|
GlComponent(const GlComponent&) = delete;
|
||||||
GlComponent(GlComponent&&) = default;
|
GlComponent(GlComponent&&) = default;
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,13 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "uui/container.hpp"
|
|
||||||
#include "uui/component.hpp"
|
#include "uui/component.hpp"
|
||||||
|
#include "uui/container.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
{
|
{
|
||||||
class GlContainer: virtual public Container
|
class GlContainer: virtual public Container
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GlContainer() = default;
|
GlContainer() = default;
|
||||||
GlContainer(const GlContainer&) = default;
|
GlContainer(const GlContainer&) = default;
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "uui/config.hpp"
|
|
||||||
#include "uui/opengl/application.hpp"
|
#include "uui/opengl/application.hpp"
|
||||||
#include "uui/opengl/container.hpp"
|
#include "uui/opengl/container.hpp"
|
||||||
#include "uui/opengl/font_manager.hpp"
|
#include "uui/opengl/font_manager.hpp"
|
||||||
|
#include "uui/types.hpp"
|
||||||
#include "uui/window.hpp"
|
#include "uui/window.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
#include <optional>
|
#include <optional>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
|
||||||
#include "config.hpp"
|
#include "types.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "uui/application.hpp"
|
#include "uui/application.hpp"
|
||||||
#include "uui/config.hpp"
|
|
||||||
#include "uui/component.hpp"
|
#include "uui/component.hpp"
|
||||||
#include "uui/flex.hpp"
|
#include "uui/flex.hpp"
|
||||||
#include "uui/label.hpp"
|
#include "uui/label.hpp"
|
||||||
#include "uui/stack.hpp"
|
#include "uui/stack.hpp"
|
||||||
|
#include "uui/types.hpp"
|
||||||
#include "uui/window.hpp"
|
#include "uui/window.hpp"
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "uui/application.hpp"
|
#include "uui/application.hpp"
|
||||||
#include "uui/config.hpp"
|
|
||||||
#include "uui/container.hpp"
|
#include "uui/container.hpp"
|
||||||
#include "uui/font_manager.hpp"
|
#include "uui/font_manager.hpp"
|
||||||
|
#include "uui/types.hpp"
|
||||||
|
|
||||||
namespace uui
|
namespace uui
|
||||||
{
|
{
|
||||||
|
|
@ -39,12 +39,6 @@ public:
|
||||||
int height() { return _height; };
|
int height() { return _height; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#ifdef DEBUG
|
|
||||||
constexpr static bool debug_mode = true;
|
|
||||||
#else
|
|
||||||
constexpr static bool debug_mode = false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::shared_ptr<Application> _app;
|
std::shared_ptr<Application> _app;
|
||||||
bool _initialized;
|
bool _initialized;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@
|
||||||
|
|
||||||
* Let custom rendering
|
* Let custom rendering
|
||||||
|
|
||||||
|
* Canvas for easy drawing
|
||||||
|
|
||||||
|
* Style/Config watch option : real-time update on file change
|
||||||
|
|
||||||
|
|
||||||
## Technical
|
## Technical
|
||||||
|
|
||||||
|
|
@ -26,4 +30,4 @@
|
||||||
|
|
||||||
## Layout / Style
|
## Layout / Style
|
||||||
|
|
||||||
* Constraint based? padding/margin?
|
* CSS subset
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,8 @@ int main()
|
||||||
auto app = uui::create_application(uui::Application::OPENGL);
|
auto app = uui::create_application(uui::Application::OPENGL);
|
||||||
// auto app2 = uui::create_application(uui::Application::OPENGL); // exception : application already created
|
// auto app2 = uui::create_application(uui::Application::OPENGL); // exception : application already created
|
||||||
app->create_window(800, 600, "OpenGl!", [](uui::Window& window) {
|
app->create_window(800, 600, "OpenGl!", [](uui::Window& window) {
|
||||||
for(int i = 0; i < 100; i += 1) window.create_label(4 * i, 4 * i, "Hello World!", {1.0f, 1.0f, 1.0f, 0.5f}, {});
|
for(int i = 0; i < 100; i += 1)
|
||||||
|
window.create_label(4 * i, 4 * i, "Hello World!", {1.0f, 1.0f, 1.0f, 0.5f}, {});
|
||||||
});
|
});
|
||||||
app->run();
|
app->run();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,45 +31,37 @@ int main()
|
||||||
window.create_label(0.75f, 0.75f, "Hello World!", {1.0f, 1.0f, 1.0f, 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) {
|
window.create_flex(200, 0.6f, uui::Direction::HORIZONTAL, [](uui::Flex& flex) {
|
||||||
flex.create_component(100, 50, [](uui::Component& component) {
|
flex.create_component(
|
||||||
component.set_background_color(0.2f, 0.75f, 0.25f);
|
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_label("test", {0.8f, 0.2f, 0.2f, 1.0f}, {});
|
||||||
flex.create_component(100, 20, [](uui::Component& component) {
|
flex.create_component(
|
||||||
component.set_background_color(0.2f, 0.25f, 0.75f);
|
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) {
|
window.create_flex(50, 400, uui::Direction::VERTICAL, [](uui::Flex& flex) {
|
||||||
flex.create_component(50, 100, [](uui::Component& component) {
|
flex.create_component(
|
||||||
component.set_background_color(0.2f, 0.75f, 0.25f);
|
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_label("test", {0.8f, 0.2f, 0.2f, 1.0f}, {});
|
||||||
flex.create_component(100, 20, [](uui::Component& component) {
|
flex.create_component(
|
||||||
component.set_background_color(0.2f, 0.25f, 0.75f);
|
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) {
|
app->create_window(800, 600, "OpenGl 2", [](uui::Window& window) {
|
||||||
window.create_stack(200, 0.6f, uui::Direction::HORIZONTAL, [](uui::Stack& stack) {
|
window.create_stack(200, 0.6f, uui::Direction::HORIZONTAL, [](uui::Stack& stack) {
|
||||||
stack.create_component(100, 50, [](uui::Component& component) {
|
stack.create_component(
|
||||||
component.set_background_color(0.2f, 0.75f, 0.25f);
|
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_label("test", {0.8f, 0.2f, 0.2f, 1.0f}, {});
|
||||||
stack.create_component(100, 20, [](uui::Component& component) {
|
stack.create_component(
|
||||||
component.set_background_color(0.2f, 0.25f, 0.75f);
|
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) {
|
window.create_stack(50, 400, uui::Direction::VERTICAL, [](uui::Stack& stack) {
|
||||||
stack.create_component(100, 50, [](uui::Component& component) {
|
stack.create_component(
|
||||||
component.set_background_color(0.2f, 0.75f, 0.25f);
|
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_label("test", {0.8f, 0.2f, 0.2f, 1.0f}, {});
|
||||||
stack.create_component(100, 20, [](uui::Component& component) {
|
stack.create_component(
|
||||||
component.set_background_color(0.2f, 0.25f, 0.75f);
|
100, 20, [](uui::Component& component) { component.set_background_color(0.2f, 0.25f, 0.75f); });
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ uui::GlComponent::GlComponent(
|
||||||
std::shared_ptr<uui::GlWindow> window, std::size_t window_index, std::shared_ptr<uui::GlContainer> parent,
|
std::shared_ptr<uui::GlWindow> window, std::size_t window_index, std::shared_ptr<uui::GlContainer> parent,
|
||||||
std::size_t parent_index, const position_t x, const position_t y, const position_t width, const position_t height)
|
std::size_t parent_index, const position_t x, const position_t y, const position_t width, const position_t height)
|
||||||
{
|
{
|
||||||
if constexpr(debug_mode)
|
if constexpr(uui::Application::debug_mode)
|
||||||
std::cout << "Creating a GlComponent " << parent_index << std::endl;
|
std::cout << "Creating a GlComponent " << parent_index << std::endl;
|
||||||
|
|
||||||
gl_window = window;
|
gl_window = window;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ std::tuple<int, int> uui::GlContainer::get_child_position(const std::size_t chil
|
||||||
|
|
||||||
uui::GlContainer::~GlContainer()
|
uui::GlContainer::~GlContainer()
|
||||||
{
|
{
|
||||||
if constexpr(debug_mode)
|
if constexpr(uui::Application::debug_mode)
|
||||||
std::cout << "Destroying GlContainer" << std::endl;
|
std::cout << "Destroying GlContainer" << std::endl;
|
||||||
components.clear();
|
components.clear();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include "uui/config.hpp"
|
#include "uui/types.hpp"
|
||||||
#include "uui/opengl/application.hpp"
|
#include "uui/opengl/application.hpp"
|
||||||
#include "uui/opengl/gl_utils.hpp"
|
#include "uui/opengl/gl_utils.hpp"
|
||||||
#include "uui/shader.hpp"
|
#include "uui/shader.hpp"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ uui::GlLabel::GlLabel(
|
||||||
GlComponent(window, window_index, parent, parent_index, x, y, 0.0f, 0.0f),
|
GlComponent(window, window_index, parent, parent_index, x, y, 0.0f, 0.0f),
|
||||||
text(text), text_color(text_color)
|
text(text), text_color(text_color)
|
||||||
{
|
{
|
||||||
if constexpr(debug_mode)
|
if constexpr(uui::Application::debug_mode)
|
||||||
std::cout << "Creating GlLabel " << parent_index << std::endl;
|
std::cout << "Creating GlLabel " << parent_index << std::endl;
|
||||||
|
|
||||||
font_index = 0;
|
font_index = 0;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
#include "uui/opengl/flex.hpp"
|
#include "uui/opengl/flex.hpp"
|
||||||
#include "uui/opengl/gl_utils.hpp"
|
#include "uui/opengl/gl_utils.hpp"
|
||||||
#include "uui/opengl/label.hpp"
|
#include "uui/opengl/label.hpp"
|
||||||
#include "uui/opengl/flex.hpp"
|
|
||||||
#include "uui/opengl/stack.hpp"
|
#include "uui/opengl/stack.hpp"
|
||||||
#include "uui/shader.hpp"
|
#include "uui/shader.hpp"
|
||||||
|
|
||||||
|
|
@ -80,7 +79,8 @@ void uui::GlWindow::glfw_iconify_callback(GLFWwindow* window, int iconified)
|
||||||
gl_window->_iconified = iconified;
|
gl_window->_iconified = iconified;
|
||||||
}
|
}
|
||||||
|
|
||||||
void uui::GlWindow::glfw_key_callback(GLFWwindow* window, int key, int scancode [[maybe_unused]], int action, int mods [[maybe_unused]])
|
void uui::GlWindow::glfw_key_callback(
|
||||||
|
GLFWwindow* window, int key, int scancode [[maybe_unused]], int action, int mods [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
if(key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
|
||||||
glfwSetWindowShouldClose(window, true);
|
glfwSetWindowShouldClose(window, true);
|
||||||
|
|
@ -96,7 +96,7 @@ uui::GlWindow::GlWindow(std::shared_ptr<uui::Application> app, int width, int he
|
||||||
_resize_needed = false;
|
_resize_needed = false;
|
||||||
_iconified = false;
|
_iconified = false;
|
||||||
|
|
||||||
if constexpr(debug_mode)
|
if constexpr(uui::Application::debug_mode)
|
||||||
std::cout << "Creating GlWindow : " << title << std::endl;
|
std::cout << "Creating GlWindow : " << title << std::endl;
|
||||||
this->title = title;
|
this->title = title;
|
||||||
type = Type::WINDOW;
|
type = Type::WINDOW;
|
||||||
|
|
@ -104,11 +104,11 @@ uui::GlWindow::GlWindow(std::shared_ptr<uui::Application> app, int width, int he
|
||||||
|
|
||||||
uui::GlWindow::~GlWindow()
|
uui::GlWindow::~GlWindow()
|
||||||
{
|
{
|
||||||
if constexpr(debug_mode)
|
if constexpr(uui::Application::debug_mode)
|
||||||
std::cout << "Destructor GlWindow : " << title << std::endl;
|
std::cout << "Destructor GlWindow : " << title << std::endl;
|
||||||
if(_initialized)
|
if(_initialized)
|
||||||
{
|
{
|
||||||
if constexpr(debug_mode)
|
if constexpr(uui::Application::debug_mode)
|
||||||
std::cout << "Destructor-deinit GlWindow : " << title << std::endl;
|
std::cout << "Destructor-deinit GlWindow : " << title << std::endl;
|
||||||
deinit();
|
deinit();
|
||||||
}
|
}
|
||||||
|
|
@ -330,4 +330,3 @@ void uui::GlWindow::create_stack(
|
||||||
if(stack != nullptr && init != nullptr)
|
if(stack != nullptr && init != nullptr)
|
||||||
init(*stack);
|
init(*stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue