// // Created by bruno on 4/24/25. // #ifndef FACTORYGAME_TILE_H #define FACTORYGAME_TILE_H #include "belt.h" #include "../util/util.h" #include "../items/item.h" #define MAP_WIDTH 600 #define MAP_HEIGHT 340 #define DISPLAY_MAP_WIDTH 44 #define DISPLAY_MAP_HEIGHT 22 #define TILE_SIZE 32 #define DISPLAY_WIDTH DISPLAY_MAP_WIDTH * TILE_SIZE #define DISPLAY_HEIGHT DISPLAY_MAP_HEIGHT * TILE_SIZE extern SDL_Texture *tilesTexture; extern SDL_Texture *itemsTexture; extern int scrollFrame; extern unsigned long beltFrames; typedef struct { uint16_t type; char name[20]; SDL_Texture *textures[ORIENT_DIRECTION_COUNT]; uint16_t breakTime; } TileType; #define TILEREGISTRY_SIZE 512 extern TileType TileRegistry[TILEREGISTRY_SIZE]; #define TYPE_AIR 0 #define TYPE_BELT 2 void renderAllTiles(SDL_Renderer *renderer, SDL_Rect playerRect); typedef struct { OrientDirection direction; uint16_t type; int frameOffset; ItemOnBelt items[2]; int x; int y; } Tile; extern Tile tileMap[MAP_HEIGHT][MAP_WIDTH]; void generateTestMap(); void loadTiles(SDL_Renderer *renderer); extern uint16_t tileTypeIndex; uint16_t getBreakTime(int type); void initTiles(); #endif //FACTORYGAME_TILE_H