#pragma once

#include <lvgl.h>
#include <cstdint>

namespace GameKit {

struct GridPos {
    int16_t x = 0;
    int16_t y = 0;
};

inline bool operator==(GridPos a, GridPos b) { return a.x == b.x && a.y == b.y; }
inline bool operator!=(GridPos a, GridPos b) { return !(a == b); }

struct GridSpec {
    uint8_t cols = 0;
    uint8_t rows = 0;
    uint16_t cellPx = 0;
    uint16_t originX = 0;
    uint16_t originY = 0;
};

lv_point_t gridToPx(const GridSpec& grid, GridPos pos);
bool gridContains(const GridSpec& grid, GridPos pos);

} // namespace GameKit
