68 virtual void Create()
override;
69 virtual void Destroy()
override;
75 void SetTileSet(
TileSet* tileSet);
81 void SetOrigin(glm::vec2 origin) { mOrigin = origin; }
89 TileCell GetCell(int32_t cellX, int32_t cellY, int32_t layerIndex = 0)
const;
90 void SetCell(int32_t cellX, int32_t cellY,
const TileCell& cell, int32_t layerIndex = 0);
91 void ClearCell(int32_t cellX, int32_t cellY, int32_t layerIndex = 0);
92 bool IsCellOccupied(int32_t cellX, int32_t cellY, int32_t layerIndex = 0)
const;
95 int32_t GetTile(int32_t cellX, int32_t cellY, int32_t layerIndex = 0)
const;
96 void SetTile(int32_t cellX, int32_t cellY, int32_t tileIndex, int32_t layerIndex = 0);
101 int32_t ReplaceTile(int32_t oldIndex, int32_t newIndex, int32_t layerIndex = 0);
102 int32_t ReplaceTilesWithTag(
const std::string& tag, int32_t newIndex, int32_t layerIndex = 0);
103 int32_t CountTileUses(int32_t tileIndex, int32_t layerIndex = 0)
const;
113 const std::unordered_set<int64_t>&
GetDirtyChunks()
const {
return mDirtyChunks; }
118 static int64_t PackChunkKey(int32_t chunkX, int32_t chunkY);
119 static void UnpackChunkKey(int64_t key, int32_t& outChunkX, int32_t& outChunkY);
120 static int32_t FloorDivChunk(int32_t cell);
121 static int32_t FloorModChunk(int32_t cell);
123 static bool HandlePropChange(
class Datum* datum, uint32_t index,
const void* newValue);
127 void EnsureLayer(int32_t layerIndex);
128 void RecomputeUsedBounds();
134 glm::ivec2 mTileSize = { 1, 1 };
135 glm::vec2 mOrigin = { 0.0f, 0.0f };
136 bool mAllowNegativeCoords =
true;
140 glm::ivec2 mMinUsed = { 0, 0 };
141 glm::ivec2 mMaxUsed = { 0, 0 };
142 bool mHasContent =
false;