displayLayout and Rendering TUI library | 
          
| git clone git://git.dimitrijedobrota.com/display.git | 
| Log | Files | Refs | README | LICENSE | HACKING | CONTRIBUTING | CODE_OF_CONDUCT | BUILDING | 
| commit | 6d854e1e253d3d9237b09ab513d6d03061a54526 | 
| parent | 39d2c64dea7e57890dc58e8d4c60bbba916833a6 | 
| author | Dimitrije Dobrota < mail@dimitrijedobrota.com > | 
| date | Fri, 7 Feb 2025 11:02:43 +0100 | 
Better types, window setters
| M | CMakeLists.txt | | | + - | 
| M | example/example.cpp | | | ++++ --- | 
| M | include/display/layout.hpp | | | +++++++++++++++++++++++++ ---------------- | 
3 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/ CMakeLists.txt b/ CMakeLists.txt
          @@ -4,7 +4,7 @@ 
          include(cmake/prelude.cmake)
        
        
          project(
              display
              VERSION 0.1.2
              VERSION 0.1.3
              DESCRIPTION "TUI library"
              HOMEPAGE_URL "https://example.com/"
              LANGUAGES CXX
        
        diff --git a/ example/example.cpp b/ example/example.cpp
          @@ -30,9 +30,10 @@ 
          int main()
        
        
            display::start();
            display::LayoutFree layout;
            layout.add_window({3, 3, 15, 15});
            layout.add_window({0, 0, 10, 10}, 1);
            layout.add_window({5, 5, 5, 10}, 1);
            layout.add_window({{3, 3}, {15, 15}});
            layout.add_window({{0, 0}, {10, 10}}, 1);
            layout.add_window({{5, 5}, {5, 10}}, 1);
            layout.add_window({{15, 15}, {5, 10}}, 1);
            layout.render(renderer);
            while (true) {
        
        diff --git a/ include/display/layout.hpp b/ include/display/layout.hpp
@@ -7,30 +7,38 @@
namespace display
          {
          using sz_t = std::uint16_t;
          using pos_t = std::pair<sz_t, sz_t>;
          using dim_t = std::pair<sz_t, sz_t>;
          class Window
          {
          public:
            Window(std::uint16_t xpos,
                   std::uint16_t ypos,
                   std::uint16_t width,
                   std::uint16_t height)
                : m_xpos(xpos)
                , m_ypos(ypos)
                , m_width(width)
                , m_height(height)
            Window(pos_t pos, dim_t dim)
                : m_pos(std::move(pos))
                , m_dim(std::move(dim))
            {
            }
            auto xpos() const { return m_xpos; }
            auto ypos() const { return m_ypos; }
            auto width() const { return m_width; }
            auto height() const { return m_height; }
            auto& pos() const { return m_pos; }
            auto xpos() const { return m_pos.first; }
            auto ypos() const { return m_pos.second; }
            auto& dim() const { return m_dim; }
            auto width() const { return m_dim.first; }
            auto height() const { return m_dim.second; }
            auto set_pos(pos_t pos) { m_pos = std::move(pos); }
            auto set_xpos(sz_t val) { m_pos.first = val; }
            auto set_ypos(sz_t val) { m_pos.second = val; }
            auto set_dim(dim_t dim) { m_dim = std::move(dim); }
            auto set_width(sz_t val) { m_dim.first = val; }
            auto set_height(sz_t val) { m_dim.second = val; }
          private:
            std::uint16_t m_xpos;
            std::uint16_t m_ypos;
            std::uint16_t m_width;
            std::uint16_t m_height;
            pos_t m_pos;
            dim_t m_dim;
          };
          class LayoutFree
        
        
          @@ -39,6 +47,7 @@ 
          public:
        
        
            using render_f = int(Window&);
            void add_window(Window window, int zidx = -1);
            int render(render_f renderer);
          private: