载入中...
搜索中...
未找到
eve::map 命名空间参考

放置世界:格子占用(多通道)+ 地形语义 + 已放置建筑实例。 行为由 PlacementSystem 提供;本类暴露便于脚本绑定的薄封装方法。 坐标换算统一走 eve::grid(支持 rectangle / iso / staggered / hex 与 XY/XZ 平面轴)。 更多...

struct  DualGridOptions
 Dual-grid autotile (Oskar Stålberg style). 更多...
 
class  FlowField
 Integration + direction field for group pathfinding to a single goal. nextX/nextY point to the neighboring cell with lower cost (toward goal). At the goal, next points to itself. 更多...
 
class  Fov
 Dynamic field-of-view / fog-of-war facade. Phase A: 2D shadowcast + multi-revealer + explored memory. Phase B: raycast/permissive, heightmap, volume, dirty-skip, CPU masks. Phase C: hex topology FOV, rectangle-based FOV, perception/stealth detection helpers, GPU mask Texture upload. 更多...
 
class  Map
 Map module — factory + script binding for 2D tilemaps. Per-frame: TileConfigSystem (hot reload) → unified sprite+tile render. Pathfinding: newPathfinder / newPathfinderSize → A* + Flow Field group paths. FOV: newFov / newFovSize → shadowcast visibility + explored memory. 更多...
 
struct  MapObject
 A named, typed rectangle object from a Tiled objectgroup layer. Used by Map::setObjects / getObject* for gameplay spawn points, triggers, etc. 更多...
 
class  Path
 Ordered tile-index waypoints from start to goal (inclusive). 更多...
 
class  Pathfinder
 Pathfinding facade. Single-agent: A*. Group (same goal): Flow Field + follow. Grid/topology internals stay out of the public ABI (Windows export limit). 更多...
 
class  TileConfigSystem
 Polls bound config files (Resource.path) and hot-reloads when modtime changes. Returns number of layers reloaded. 更多...
 
class  TileLayer
 ECS tile layer entity. Script mutates tile GIDs / tileset / draw; TileRenderSystem batch-draws atlas quads (or solid debug colors when no texture). 更多...
 
class  TileRenderSystem
 Draws all visible TileLayer entities via Graphics batch path (UV atlas quads). 更多...
 

枚举

enum class  MapOrientation { Orthogonal , Isometric , Staggered , Hexagonal }
 Tile map layout: orthogonal, isometric, staggered, or hexagonal. 更多...
 
enum class  StaggerAxis { X , Y }
 Stagger axis for staggered/hex maps (shift every other row/column). 更多...
 
enum class  StaggerIndex { Odd , Even }
 Which rows/columns are offset by half a tile. 更多...
 

函数

const std::array< int, 16 > & dualGridDefaultFrameTable ()
 Copy of the default frame table (16 entries).
 
int dualGridDefaultFrame (int mask)
 Default 4x4 atlas frame index for mask 0..15. -1 means draw nothing. Matches the SpriteCook / common dual-grid sheet layout.
 
void dualGridHalfOffset (const TileLayer::Config &cfg, float &offX, float &offY)
 Half-step origin delta for the display layer (added to logic origin). Orthogonal: (-tileW/2, -tileH/2) Isometric: (0, -tileH/2) — equivalent to logic coords (tx-0.5, ty-0.5) Staggered/Hex Y: (-tileW/2, -pitchY/2) Staggered/Hex X: (-pitchX/2, -tileH/2)
 
bool dualGridLogicFilled (TileLayer &logic, int tx, int ty, int filledGid)
 Whether logic cell (tx,ty) is filled under options. Out of bounds → false.
 
int dualGridMaskAt (TileLayer &logic, int dx, int dy, int filledGid=0)
 4-bit corner mask for display cell (dx,dy) on a (logicW+1)×(logicH+1) grid. Samples logic (dx-1,dy-1), (dx,dy-1), (dx-1,dy), (dx,dy) in index space (orientation-independent topology).
 
bool resolveDualGrid (TileLayer *logic, TileLayer *display, const DualGridOptions &opts, std::string *error=nullptr)
 Resolve logic → display dual-grid tiles. Resizes display to (logicW+1)×(logicH+1), copies tile size / orientation / stagger / hex from logic, optionally applies projection-correct half-step origin offset, writes GIDs. Returns false and sets error on invalid args.
 
bool resolveDualGrid (TileLayer *logic, TileLayer *display, std::string *error=nullptr)
 Convenience: any non-zero filled, default frame table, half offset, hide logic.
 
int dualGridMaskFromCorners (bool tl, bool tr, bool bl, bool br)
 Pack four corner occupancy bits: TL=1, TR=2, BL=4, BR=8.
 
 Module_IMPL (Map, new Map())
 
bool applyConfigDocument (TileLayer *layer, data::JsonDocument *doc)
 Apply map/layer JSON onto an existing TileLayer (Config + Tiles + Tileset + Draw). Multi-layer documents only apply the first tile layer when called on one entity.
 
bool applyConfigText (TileLayer *layer, const std::string &json, std::string *error=nullptr)
 Parse JSON text and apply onto one layer.
 
bool loadConfigFile (TileLayer *layer, const std::string &path, std::string *error=nullptr)
 Read path via Filesystem, apply onto layer, bind Resource.path + modtime for hot reload. If the document has multiple tile layers, only the first is applied to layer.
 
bool reloadConfigFile (TileLayer *layer, std::string *error)
 
std::vector< TileLayer * > loadMapText (const std::string &json, std::vector< MapObject > *objects, std::string *error=nullptr)
 Parse map JSON text (no filesystem). Same semantics as loadMapFile.
 
std::vector< TileLayer * > loadMapFile (const std::string &path, std::vector< MapObject > *objects, std::string *error)
 
std::vector< TileLayer * > loadMapFile (const std::string &path, std::string *error=nullptr)
 Load a (possibly multi-layer) map JSON. Creates one TileLayer per tile layer. Optionally fills objects from objectgroup layers. Returns created layers (empty on failure). All share the same Resource.path for reload.
 
uint32_t tileGid (uint32_t raw)
 Strip Tiled flip / rotate flags; keep low 28 bits.
 
void tileToWorld (const TileLayer::Config &cfg, int tx, int ty, float &wx, float &wy)
 Converts a tile index to world pixels using the layer's projection.
 
float tileToDepthY (const TileLayer::Config &cfg, int tx, int ty)
 Painter's-algorithm depth for the tile under the layer's projection.
 
void worldToTile (const TileLayer::Config &cfg, float wx, float wy, int &tx, int &ty)
 Converts world pixels back to the containing tile index.
 

详细描述

放置世界:格子占用(多通道)+ 地形语义 + 已放置建筑实例。 行为由 PlacementSystem 提供;本类暴露便于脚本绑定的薄封装方法。 坐标换算统一走 eve::grid(支持 rectangle / iso / staggered / hex 与 XY/XZ 平面轴)。

枚举类型说明

◆ MapOrientation

enum class eve::map::MapOrientation
strong

Tile map layout: orthogonal, isometric, staggered, or hexagonal.

枚举值
Orthogonal 
Isometric 
Staggered 
Hexagonal 

在文件 TileOrientation.h6 行定义.

◆ StaggerAxis

enum class eve::map::StaggerAxis
strong

Stagger axis for staggered/hex maps (shift every other row/column).

枚举值

在文件 TileOrientation.h8 行定义.

◆ StaggerIndex

enum class eve::map::StaggerIndex
strong

Which rows/columns are offset by half a tile.

枚举值
Odd 
Even 

在文件 TileOrientation.h10 行定义.

函数说明

◆ applyConfigDocument()

bool eve::map::applyConfigDocument ( TileLayer layer,
data::JsonDocument doc 
)

Apply map/layer JSON onto an existing TileLayer (Config + Tiles + Tileset + Draw). Multi-layer documents only apply the first tile layer when called on one entity.

在文件 TileConfig.cpp577 行定义.

引用了 eve::map::TileLayer::getMapHeight(), eve::map::TileLayer::getMapWidth(), eve::data::JsonDocument::isObject(), layer , 以及 eve::data::JsonDocument::object().

◆ applyConfigText()

bool eve::map::applyConfigText ( TileLayer layer,
const std::string &  json,
std::string *  error 
)

Parse JSON text and apply onto one layer.

在文件 TileConfig.cpp609 行定义.

引用了 error, eve::map::TileLayer::getMapHeight(), eve::map::TileLayer::getMapWidth() , 以及 layer.

被这些函数引用 eve::map::TileLayer::applyConfig() , 以及 loadConfigFile().

◆ dualGridDefaultFrame()

int eve::map::dualGridDefaultFrame ( int  mask)

Default 4x4 atlas frame index for mask 0..15. -1 means draw nothing. Matches the SpriteCook / common dual-grid sheet layout.

在文件 DualGrid.cpp33 行定义.

被这些函数引用 eve::map::Map::dualGridFrame() , 以及 resolveDualGrid().

◆ dualGridDefaultFrameTable()

const std::array< int, 16 > & eve::map::dualGridDefaultFrameTable ( )

Copy of the default frame table (16 entries).

在文件 DualGrid.cpp31 行定义.

◆ dualGridHalfOffset()

void eve::map::dualGridHalfOffset ( const TileLayer::Config cfg,
float &  offX,
float &  offY 
)

Half-step origin delta for the display layer (added to logic origin). Orthogonal: (-tileW/2, -tileH/2) Isometric: (0, -tileH/2) — equivalent to logic coords (tx-0.5, ty-0.5) Staggered/Hex Y: (-tileW/2, -pitchY/2) Staggered/Hex X: (-pitchX/2, -tileH/2)

在文件 DualGrid.cpp38 行定义.

引用了 Hexagonal, Isometric, eve::map::TileLayer::Config::orientation, Orthogonal, eve::map::TileLayer::Config::staggerAxis, Staggered, eve::map::TileLayer::Config::tileH, eve::map::TileLayer::Config::tileW , 以及 Y.

被这些函数引用 eve::map::Map::dualGridOffsetX(), eve::map::Map::dualGridOffsetY() , 以及 resolveDualGrid().

◆ dualGridLogicFilled()

bool eve::map::dualGridLogicFilled ( TileLayer logic,
int  tx,
int  ty,
int  filledGid 
)

Whether logic cell (tx,ty) is filled under options. Out of bounds → false.

在文件 DualGrid.cpp63 行定义.

引用了 eve::map::TileLayer::getTile() , 以及 tileGid().

被这些函数引用 dualGridMaskAt().

◆ dualGridMaskAt()

int eve::map::dualGridMaskAt ( TileLayer logic,
int  dx,
int  dy,
int  filledGid 
)

4-bit corner mask for display cell (dx,dy) on a (logicW+1)×(logicH+1) grid. Samples logic (dx-1,dy-1), (dx,dy-1), (dx-1,dy), (dx,dy) in index space (orientation-independent topology).

在文件 DualGrid.cpp72 行定义.

引用了 dualGridLogicFilled(), dualGridMaskFromCorners() , 以及 tr.

被这些函数引用 eve::map::Map::dualGridMaskAt() , 以及 resolveDualGrid().

◆ dualGridMaskFromCorners()

int eve::map::dualGridMaskFromCorners ( bool  tl,
bool  tr,
bool  bl,
bool  br 
)
inline

Pack four corner occupancy bits: TL=1, TR=2, BL=4, BR=8.

在文件 DualGrid.h48 行定义.

引用了 tr.

被这些函数引用 dualGridMaskAt().

◆ loadConfigFile()

bool eve::map::loadConfigFile ( TileLayer layer,
const std::string &  path,
std::string *  error 
)

Read path via Filesystem, apply onto layer, bind Resource.path + modtime for hot reload. If the document has multiple tile layers, only the first is applied to layer.

在文件 TileConfig.cpp650 行定义.

引用了 applyConfigText(), data, error, layer, eve::filesystem::Filesystem::read() , 以及 eve::filesystem::Filesystem::watch().

被这些函数引用 eve::map::TileLayer::loadConfig() , 以及 reloadConfigFile().

◆ loadMapFile() [1/2]

std::vector< TileLayer * > eve::map::loadMapFile ( const std::string &  path,
std::string *  error 
)

Load a (possibly multi-layer) map JSON. Creates one TileLayer per tile layer. Optionally fills objects from objectgroup layers. Returns created layers (empty on failure). All share the same Resource.path for reload.

在文件 TileConfig.cpp737 行定义.

引用了 error , 以及 loadMapFile().

◆ loadMapFile() [2/2]

std::vector< TileLayer * > eve::map::loadMapFile ( const std::string &  path,
std::vector< MapObject > *  objects,
std::string *  error 
)

◆ loadMapText()

std::vector< TileLayer * > eve::map::loadMapText ( const std::string &  json,
std::vector< MapObject > *  objects,
std::string *  error 
)

Parse map JSON text (no filesystem). Same semantics as loadMapFile.

在文件 TileConfig.cpp692 行定义.

引用了 error.

◆ Module_IMPL()

eve::map::Module_IMPL ( Map  ,
new   Map() 
)

◆ reloadConfigFile()

bool eve::map::reloadConfigFile ( TileLayer layer,
std::string *  error 
)

在文件 TileConfig.cpp682 行定义.

引用了 error, layer , 以及 loadConfigFile().

被这些函数引用 eve::map::TileConfigSystem::poll() , 以及 eve::map::TileLayer::reloadConfig().

◆ resolveDualGrid() [1/2]

◆ resolveDualGrid() [2/2]

bool eve::map::resolveDualGrid ( TileLayer logic,
TileLayer display,
std::string *  error 
)

Convenience: any non-zero filled, default frame table, half offset, hide logic.

在文件 DualGrid.cpp147 行定义.

引用了 error , 以及 resolveDualGrid().

◆ tileGid()

uint32_t eve::map::tileGid ( uint32_t  raw)
inline

Strip Tiled flip / rotate flags; keep low 28 bits.

在文件 TileLayer.h161 行定义.

被这些函数引用 eve::map::TileRenderSystem::collect(), dualGridLogicFilled() , 以及 eve::map::Fov::Impl::syncFromLayer().

◆ tileToDepthY()

float eve::map::tileToDepthY ( const TileLayer::Config cfg,
int  tx,
int  ty 
)

Painter's-algorithm depth for the tile under the layer's projection.

在文件 TileProjection.cpp43 行定义.

引用了 eve::grid::cellToDepthY().

被这些函数引用 eve::map::TileRenderSystem::collect() , 以及 eve::map::TileLayer::depthY().

◆ tileToWorld()

void eve::map::tileToWorld ( const TileLayer::Config cfg,
int  tx,
int  ty,
float &  wx,
float &  wy 
)

Converts a tile index to world pixels using the layer's projection.

在文件 TileProjection.cpp39 行定义.

引用了 eve::grid::cellToWorld().

被这些函数引用 eve::map::TileRenderSystem::collect() , 以及 eve::map::TileLayer::tileToWorld().

◆ worldToTile()

void eve::map::worldToTile ( const TileLayer::Config cfg,
float  wx,
float  wy,
int &  tx,
int &  ty 
)

Converts world pixels back to the containing tile index.

在文件 TileProjection.cpp47 行定义.

引用了 eve::map::TileLayer::Config::mapH, eve::map::TileLayer::Config::mapW , 以及 eve::grid::worldToCell().

被这些函数引用 eve::map::TileLayer::worldToTile().