load("@bazel_skylib//rules:run_binary.bzl", "run_binary")
load("helpers.bzl", "add_sprites")

cc_library(
    name = "game",
    srcs = glob(["*.c"]) + [
        "art/game_collectibles.c",
        "art/game_npcs.c",
        "art/game_player.c",
        "art/game_tiles.c",
        "map/game_map.c",
        "map/game_map_entities.c",
    ],
    hdrs = glob(["*.h", "art/*.h", "map/*.h"]),
    visibility = ["//visibility:public"],
    deps = ["//device:device", "//sys:sys"]
)

add_sprites(name="game_collectibles", n=24)
add_sprites(name="game_player", n=96)
add_sprites(name="game_npcs", n=64)
add_sprites(name="game_tiles", n=120)

run_binary(
    name = "game_map",
    args = [
        "game_map",
        "$(location :map/game_map.ldtk)",
        "$(location :map/game_map.c)",
    ],
    srcs = [":map/game_map.ldtk"],
    outs = [":map/game_map.c"],
    tool = "//pytools:mapdata"
)