Files
factorygame/tiles/tile.h
2025-05-30 22:31:59 +02:00

56 lines
1016 B
C

//
// 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 30
#define DISPLAY_MAP_HEIGHT 16
#define TILE_SIZE 32
#define DISPLAY_WIDTH DISPLAY_MAP_WIDTH * TILE_SIZE
#define DISPLAY_HEIGHT DISPLAY_MAP_HEIGHT * TILE_SIZE
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 1
typedef struct {
OrientDirection direction;
uint16_t type;
int frameOffset;
ItemOnBelt items[2][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);
#endif //FACTORYGAME_TILE_H