Brought over a bunch of stuff to get started, but only lel.cpp compiles.

This commit is contained in:
Zed A. Shaw 2025-05-05 11:42:21 -04:00
parent 26685279ce
commit 103793204d
33 changed files with 2746 additions and 0 deletions

54
lel.hpp Normal file
View file

@ -0,0 +1,54 @@
#pragma once
#include <string>
#include <unordered_map>
#include <optional>
#include <vector>
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<std::string>;
using CellMap = std::unordered_map<std::string, Cell>;
struct Parser {
int grid_x = 0;
int grid_y = 0;
int grid_w = 0;
int grid_h = 0;
Cell cur;
std::vector<Row> 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<std::string> hit(int x, int y);
};
Cell center(int width, int height, Cell &parent);
}