|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Classes | |
| struct | CellEncoding |
| struct | BlobHeader |
| class | TileGrid |
| struct | AnimFrame |
| struct | TileAnimation |
| struct | TileRange |
| struct | ChunkCoord |
| struct | ChunkCoordHash |
| struct | ChunkData |
| class | TilemapSystem |
| struct | TilesetSlot |
Enumerations | |
| enum class | GridType : u8 { Orthogonal = 0 , Isometric = 1 , StaggeredIsometric = 2 , Hexagonal = 3 } |
Functions | |
| CellEncoding | runningEncoding () |
| CellEncoding | v1Encoding () |
| void | appendBlobHeader (std::vector< u8 > &out, u32 chunkCount) |
| bool | parseBlobHeader (const u8 *raw, usize size, BlobHeader &out) |
| bool | recodeCell (u16 word, const CellEncoding &from, const CellEncoding &to, u16 &out) |
| template<class Fn> | |
| bool | walkBlobCells (const u8 *raw, usize size, const BlobHeader &header, Fn &&emit) |
| i32 | floorDiv (i32 a, i32 b) |
| i32 | floorMod (i32 a, i32 b) |
| void | applyTileFlip (float &s, float &t, bool flipH, bool flipV, bool flipD) |
| TileRange | computeVisibleRange (f32 camLeft, f32 camBottom, f32 camRight, f32 camTop, f32 originX, f32 originY, f32 tileWidth, f32 tileHeight, u32 mapWidth, u32 mapHeight) |
| uint32_t | atlasCells (float size, float margin, float tileSize, float spacing) |
| int | resolveTilesetSlot (const std::vector< TilesetSlot > &slots, uint16_t id) |
Variables | |
| static constexpr u32 | BLOB_MAGIC_V1 = 0x4D545345 |
| static constexpr u32 | BLOB_MAGIC_V2 = 0x50414D54 |
| static constexpr u32 | V1_CHUNK_SIZE = 16 |
| static constexpr u16 | V1_TILE_ID_MASK = 0x1FFF |
| static constexpr u16 | V1_TILE_FLIP_H = 0x2000 |
| static constexpr u16 | V1_TILE_FLIP_V = 0x4000 |
| static constexpr u16 | V1_TILE_FLIP_D = 0x8000 |
| constexpr usize | BLOB_HEADER_V1_BYTES = sizeof(u32) * 2 |
| constexpr usize | BLOB_HEADER_V2_BYTES = sizeof(u32) + sizeof(u16) * 6 + sizeof(u32) |
| static constexpr u16 | EMPTY_TILE = 0 |
| static constexpr u32 | CHUNK_SIZE = 16 |
| static constexpr u16 | TILE_ID_MASK = 0x1FFF |
| static constexpr u16 | TILE_FLIP_H = 0x2000 |
| static constexpr u16 | TILE_FLIP_V = 0x4000 |
| static constexpr u16 | TILE_FLIP_D = 0x8000 |
|
strong |
| Enumerator | |
|---|---|
| Orthogonal | |
| Isometric | |
| StaggeredIsometric | |
| Hexagonal | |
Definition at line 17 of file TileGrid.hpp.
|
inline |
Apply Tiled's tile-flip flags to a screen corner's normalized coordinate (s,t) in [0,1]², yielding the texture-space (s,t) to sample.
Order matters: diagonal (transpose) first, then horizontal, then vertical. That is the order Tiled encodes, so the standard rotation combos render as true rotations: 90° CW = flipH | flipD 180° = flipH | flipV 270° CW = flipV | flipD With flipD unset this reduces to plain H/V mirroring.
Definition at line 24 of file TileFlip.hpp.
|
inline |
Cells of tileSize along an atlas axis of size: n span 2*margin + n*tileSize + (n-1)*spacing (Tiled's margin borders both sides). Past them a tile samples some other tile, so it is skipped. Must agree with the SDK's atlasCells; zero when the margin leaves none, a float that would trap.
Definition at line 39 of file TilesetTable.hpp.
Referenced by esengine::TilemapRenderPlugin::collect().
| TileRange esengine::tilemap::computeVisibleRange | ( | f32 | camLeft, |
| f32 | camBottom, | ||
| f32 | camRight, | ||
| f32 | camTop, | ||
| f32 | originX, | ||
| f32 | originY, | ||
| f32 | tileWidth, | ||
| f32 | tileHeight, | ||
| u32 | mapWidth, | ||
| u32 | mapHeight ) |
Definition at line 12 of file TilemapSystem.cpp.
Floor division and its remainder, so a chunk left of the origin lands where it belongs rather than rounding toward zero.
Definition at line 173 of file ChunkBlob.hpp.
Definition at line 174 of file ChunkBlob.hpp.
|
inline |
The header and the encoding it was written under, or false where these bytes are not one of ours. The legacy magic carries no header, which is why it means the frozen v1 values and not "whatever this engine is now".
Definition at line 103 of file ChunkBlob.hpp.
References BLOB_HEADER_V1_BYTES, BLOB_HEADER_V2_BYTES, BLOB_MAGIC_V1, BLOB_MAGIC_V2, esengine::tilemap::BlobHeader::chunkCount, esengine::tilemap::CellEncoding::chunkSize, esengine::tilemap::BlobHeader::payloadAt, v1Encoding(), and esengine::tilemap::BlobHeader::wrote.
|
inline |
One cell from one encoding into another: the id it holds and the three flags it carries, at the positions the reader uses. False where the id does not FIT — a narrowed mask cannot carry it, and the only honest answers there are the tile or a refusal. Everything else is a rename of bit positions.
Definition at line 131 of file ChunkBlob.hpp.
References esengine::tilemap::CellEncoding::flipD, esengine::tilemap::CellEncoding::flipH, esengine::tilemap::CellEncoding::flipV, and esengine::tilemap::CellEncoding::idMask.
|
inline |
Index of the slot owning id — the one with the largest first_id <= id. Returns -1 if none (id below the first slot, or empty table). slots must be sorted ascending by first_id (TilemapSystem::setTilesets guarantees this).
Definition at line 51 of file TilesetTable.hpp.
|
inline |
Definition at line 66 of file ChunkBlob.hpp.
References CHUNK_SIZE, TILE_FLIP_D, TILE_FLIP_H, TILE_FLIP_V, and TILE_ID_MASK.
Referenced by appendBlobHeader().
|
inline |
What the legacy magic means, which is a fact about the past.
Definition at line 71 of file ChunkBlob.hpp.
References V1_CHUNK_SIZE, V1_TILE_FLIP_D, V1_TILE_FLIP_H, V1_TILE_FLIP_V, and V1_TILE_ID_MASK.
Referenced by parseBlobHeader().
|
inline |
Every non-empty cell the payload holds, by WORLD coordinate — the one thing that means the same under any chunk size, so a map saved at one stride reads back at another. emit(x, y, word) sees the word as it was written.
Definition at line 148 of file ChunkBlob.hpp.
References esengine::tilemap::BlobHeader::chunkCount, esengine::tilemap::CellEncoding::chunkSize, EMPTY_TILE, esengine::tilemap::BlobHeader::payloadAt, and esengine::tilemap::BlobHeader::wrote.
Definition at line 76 of file ChunkBlob.hpp.
Referenced by parseBlobHeader().
|
inlineconstexpr |
Definition at line 77 of file ChunkBlob.hpp.
Referenced by parseBlobHeader().
|
staticconstexpr |
'ESTM' — chunks only, and the encoding of the day it was written.
Definition at line 32 of file ChunkBlob.hpp.
Referenced by parseBlobHeader().
|
staticconstexpr |
'TMAP' — the same chunks behind a header that says how to read them.
Definition at line 36 of file ChunkBlob.hpp.
Referenced by appendBlobHeader(), and parseBlobHeader().
|
staticconstexpr |
Definition at line 20 of file TilemapSystem.hpp.
Referenced by esengine::TilemapRenderPlugin::collect(), runningEncoding(), and esengine::tilemap::TilemapSystem::setChunkTiles().
|
staticconstexpr |
Definition at line 18 of file TilemapSystem.hpp.
Referenced by esengine::tilemap::TilemapSystem::flipTile(), esengine::tilemap::TilemapSystem::getTile(), esengine::tilemap::TilemapSystem::rotateTile(), and walkBlobCells().
|
staticconstexpr |
Definition at line 29 of file TilemapSystem.hpp.
Referenced by esengine::tilemap::TilemapSystem::flipTile(), esengine::tilemap::TilemapSystem::rotateTile(), and runningEncoding().
|
staticconstexpr |
Definition at line 25 of file TilemapSystem.hpp.
Referenced by esengine::tilemap::TilemapSystem::flipTile(), esengine::tilemap::TilemapSystem::rotateTile(), and runningEncoding().
|
staticconstexpr |
Definition at line 27 of file TilemapSystem.hpp.
Referenced by esengine::tilemap::TilemapSystem::flipTile(), esengine::tilemap::TilemapSystem::rotateTile(), and runningEncoding().
|
staticconstexpr |
Definition at line 23 of file TilemapSystem.hpp.
Referenced by esengine::tilemap::TilemapSystem::flipTile(), esengine::tilemap::TilemapSystem::rotateTile(), and runningEncoding().
|
staticconstexpr |
Definition at line 42 of file ChunkBlob.hpp.
Referenced by v1Encoding().
|
staticconstexpr |
Definition at line 50 of file ChunkBlob.hpp.
Referenced by v1Encoding().
|
staticconstexpr |
Definition at line 46 of file ChunkBlob.hpp.
Referenced by v1Encoding().
|
staticconstexpr |
Definition at line 48 of file ChunkBlob.hpp.
Referenced by v1Encoding().
|
staticconstexpr |
Definition at line 44 of file ChunkBlob.hpp.
Referenced by v1Encoding().