11#include <unordered_map>
51 f32 tileWidth,
f32 tileHeight,
52 u32 mapWidth,
u32 mapHeight);
61 return std::hash<u64>()(
static_cast<u64>(
static_cast<u32>(c.
x))
62 | (
static_cast<u64>(
static_cast<u32>(c.
y)) << 32));
78 f32 tileWidth,
f32 tileHeight);
100 const std::string& key,
const std::string& value);
102 const std::string& key)
const;
133 glm::vec4
tint{1.0f, 1.0f, 1.0f, 1.0f};
150 std::unordered_map<ChunkCoord, ChunkData, ChunkCoordHash>
chunks;
172 std::unordered_map<u16, std::unordered_map<std::string, std::string>>
tile_properties;
181 f32 parallaxX,
f32 parallaxY);
193 f32 originX,
f32 originY,
i32& outTx,
i32& outTy)
const;
195 using LayerMap = std::unordered_map<Entity, LayerData>;
199 u32 next_generation_ = 0;
Reflection and metadata system for automatic binding generation.
#define ES_CONST(...)
Mark a constant that CROSSES the boundary, so EHT emits its TS twin.
Local tile placement and polygon containment shared by rendering and queries.
Per-layer tileset table + GID→tileset resolution (dependency-free).
Core type definitions and utilities for ESEngine.
void setOriginEntity(Entity layerKey, Entity originEntity)
void rotateTile(Entity entity, i32 x, i32 y, i32 degrees)
void setChunkTiles(Entity entity, i32 chunkX, i32 chunkY, const u16 *tiles, u32 width, u32 height)
void destroyLayer(Entity entity)
void setTiles(Entity entity, const u16 *tiles, u32 count)
void setVisible(Entity entity, bool visible)
void setHexParams(Entity entity, f32 sideLength, bool staggerAxisX, bool staggerIndexEven)
void setTileProperty(Entity entity, u16 tileId, const std::string &key, const std::string &value)
void removeChunk(Entity entity, i32 chunkX, i32 chunkY)
void setTileAnimation(Entity entity, u16 tileId, const AnimFrame *frames, u32 frameCount)
bool hasLayer(Entity entity) const
void setTile(Entity entity, i32 x, i32 y, u16 tileId)
void setTilesets(Entity entity, std::vector< TilesetSlot > slots)
void worldToTile(Entity entity, f32 wx, f32 wy, f32 originX, f32 originY, i32 &outTx, i32 &outTy) const
void clearTileAnimations(Entity entity)
void initLayer(Entity entity, u32 width, u32 height, f32 tileWidth, f32 tileHeight)
u16 getTile(Entity entity, i32 x, i32 y) const
const LayerMap & allLayers() const
void advanceAnimations(Entity entity, f32 dtMs)
void fillRect(Entity entity, i32 x, i32 y, u32 w, u32 h, u16 tileId)
void flipTile(Entity entity, i32 x, i32 y, bool flipH, bool flipV, bool flipD)
void setRenderProps(Entity entity, u32 textureHandle, u32 tilesetColumns, f32 uvTileW, f32 uvTileH, i32 sortLayer, f32 depth, f32 parallaxX, f32 parallaxY)
const LayerData * getLayerData(Entity entity) const
void tileToWorld(Entity entity, i32 tx, i32 ty, f32 originX, f32 originY, f32 &outX, f32 &outY) const
std::unordered_map< Entity, LayerData > LayerMap
u16 resolveAnimatedTile(Entity entity, u16 tileId) const
std::string getTileProperty(Entity entity, u16 tileId, const std::string &key) const
void setGridType(Entity entity, GridType type)
void setTint(Entity entity, f32 r, f32 g, f32 b, f32 a, f32 opacity)
LayerData * getLayerDataMut(Entity entity)
void initInfiniteLayer(Entity entity, f32 tileWidth, f32 tileHeight)
static constexpr u32 CHUNK_SIZE
TileRange computeVisibleRange(f32 camLeft, f32 camBottom, f32 camRight, f32 camTop, f32 originX, f32 originY, f32 tileWidth, f32 tileHeight, u32 mapWidth, u32 mapHeight)
static constexpr u16 TILE_FLIP_D
static constexpr u16 TILE_FLIP_H
static constexpr u16 EMPTY_TILE
static constexpr u16 TILE_FLIP_V
static constexpr u16 TILE_ID_MASK
std::int32_t i32
Signed 32-bit integer.
std::uint64_t u64
Unsigned 64-bit integer.
constexpr Entity INVALID_ENTITY
Invalid entity sentinel value.
std::uint32_t u32
Unsigned 32-bit integer.
std::uint16_t u16
Unsigned 16-bit integer.
double f64
64-bit floating point
float f32
32-bit floating point
Entity identifier with packed index + generation.
size_t operator()(const ChunkCoord &c) const
bool operator==(const ChunkCoord &o) const
u16 tiles[CHUNK_SIZE *CHUNK_SIZE]
std::vector< AnimFrame > frames
std::unordered_map< u16, std::unordered_map< std::string, std::string > > tile_properties
std::unordered_map< u16, TileAnimation > tile_animations
std::vector< TilesetSlot > tilesets
bool hex_stagger_axis_x
true: columns stagger (staggeraxis=x)
std::unordered_map< ChunkCoord, ChunkData, ChunkCoordHash > chunks
glm::vec2 parallax_factor
bool hex_stagger_index_even
true: even rows/cols carry the shift