#ifndef WORLD_H
#define WORLD_H

#include "twn_game_api.h"

#include <stdint.h>
#include <stdbool.h>


typedef enum TileType {
    TILE_TYPE_VOID,
    TILE_TYPE_SOLID,
} TileType;


typedef struct Tile {
    Rect rect;
    TileType type;
} Tile;


typedef struct World {
    TileType **tilemap;
    Tile *tiles;
    
    int tile_size;
    unsigned int tilemap_width;
    unsigned int tilemap_height;
    size_t tile_nonvoid_count;
    float gravity;
} World;


World *world_create(void);
void world_destroy(World *world);
void world_drawdef(World *world);
bool world_find_rect_intersects(World *world, Rect rect, Rect *intersection);
bool world_is_tile_at(World *world, float x, float y);
void world_place_tile(World *world, float x, float y);
void world_remove_tile(World *world, float x, float y);


#endif
