#pragma once #include #include #include #include #include namespace lel { struct Cell { 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; int col = 0; int row = 0; bool right = false; bool bottom = false; bool expand = false; bool center = false; bool percent = false; Cell(int col, int row) : col(col), row(row) {} Cell() {} }; 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; std::vector grid; CellMap cells; Parser(int x, int y, int width, int height); Parser(); void position(int x, int y, int width, int height); void id(std::string name); void reset(); bool parse(std::string input); void finalize(); std::optional hit(int x, int y); }; Cell center(int width, int height, Cell &parent); }