#include "GameKitDraw.h"

namespace GameKit {

lv_obj_t* makePanel(lv_obj_t* parent, lv_color_t color, uint8_t radius) {
    lv_obj_t* obj = lv_obj_create(parent);
    lv_obj_set_style_bg_color(obj, color, LV_PART_MAIN);
    lv_obj_set_style_border_width(obj, 0, LV_PART_MAIN);
    lv_obj_set_style_radius(obj, radius, LV_PART_MAIN);
    lv_obj_set_style_pad_all(obj, 0, LV_PART_MAIN);
    lv_obj_remove_flag(obj, LV_OBJ_FLAG_SCROLLABLE);
    return obj;
}

lv_obj_t* makeCell(lv_obj_t* parent, uint16_t size, lv_color_t color, uint8_t radius) {
    lv_obj_t* obj = makePanel(parent, color, radius);
    lv_obj_set_size(obj, size, size);
    return obj;
}

lv_obj_t* makeLabel(lv_obj_t* parent, const char* text, lv_color_t color) {
    lv_obj_t* label = lv_label_create(parent);
    lv_label_set_text(label, text);
    lv_obj_set_style_text_color(label, color, LV_PART_MAIN);
    return label;
}

void setCell(lv_obj_t* obj, int x, int y, uint16_t cellPx) {
    lv_obj_set_pos(obj, x * cellPx, y * cellPx);
}

} // namespace GameKit
