#ifndef PIXELDEFENSE_GAME_STATE_H
#define PIXELDEFENSE_GAME_STATE_H

#include <breeze.h>
#include <flecs.h>

typedef enum GameScreen {
    SCREEN_GAME,
    SCREEN_PAUSE_MENU,
    SCREEN_MAIN_MENU,
    SCREEN_SETTINGS,
} GameScreen;

typedef struct DrawData {
    Texture   tex;
    Rectangle src;
    Rectangle dst;
    Vector2   origin;
    f32       rotation;
} DrawData;

typedef struct Game {
    GameScreen screen;
    Camera2D camera;
    BzTileset tileset;
    BzTileMap map;
    BzSpatialGrid *entityGrid;
    f32 frameDuration;

    Font font;

    struct {
        i64 wood;
        i64 iron;
        i64 food;
        i64 gold;
        i64 pop;
    } resources;
    BzStackAlloc stackAlloc;
    struct {
        BzBTNode *workerHarvest;
        BzBTNode *moveTo;
    } BTs;
    struct {
        BzObjectPool *pathData;
        BzObjectPool *btNode;
        BzObjectPool *btNodeState;
    } pools;
    struct {
        bool drawPath;
        bool drawEntityColliders;
        bool drawMapColliders;
        bool drawSpatialGrid;
        ecs_entity_t *inspecting;
    } debug;
    f32 elapsed;

    ecs_query_t *drawQuery;
    DrawData   *drawData;
} Game;

extern ecs_world_t *ECS;

extern ECS_COMPONENT_DECLARE(Game); // defined in main.c

#endif //PIXELDEFENSE_GAME_STATE_H
