#pragma once #include #include #include #include namespace lel { struct Cell { int col = 0; int row = 0; int x = 0; int y = 0; int w = 0; int h = 0; int mid_x = 0; int mid_y = 0; int max_w = 0; int max_h = 0; bool right = false; bool bottom = false; bool expand = false; bool center = false; bool percent = false; }; using Row = std::vector; using CellMap = std::unordered_map; struct Parser { int grid_x = 0; int grid_y = 0; int grid_w = 0; int grid_h = 0; Cell cur; Cell main; std::vector grid; CellMap cells; Parser(int x, int y, int width, int height); Parser() : cur{.col=0, .row=0} {}; void position(int x, int y, int width, int height); void id(const std::string& name); void reset(); bool parse(const std::string& input); void finalize(); std::optional hit(int x, int y); }; Cell center(int width, int height, Cell &parent); }