载入中...
搜索中...
未找到
eve::map::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. 更多...

#include <Map.h>

类 eve::map::Map 继承关系图:
eve::Module

Public 成员函数

 Module_REG (Map)
 
 Map ()
 Map.
 
 ~Map () override=default
 Map.
 
TileLayer * newLayer (int mapW, int mapH, float tileW=32.f, float tileH=32.f)
 Creates a layer. @ownership Caller deletes unless documented otherwise.
 
Pathfinder * newPathfinder (TileLayer *layer)
 Pathfinder bound to a TileLayer (syncs walkability from GIDs).
 
Pathfinder * newPathfinderSize (int mapW, int mapH)
 Custom grid pathfinder (no layer); fill with setBlocked / setCellCost.
 
Fov * newFov (TileLayer *layer)
 FOV bound to a TileLayer (syncs opacity from opaque GIDs).
 
Fov * newFovSize (int mapW, int mapH)
 Custom grid FOV (no layer); fill with setOpaque.
 
Fov * newFovVolume (int mapW, int mapH, int depth)
 Volume FOV (W×H×D voxels); mode defaults to volume.
 
TileLayer * newLayerFromFile (const std::string &path)
 Load map JSON (Tiled-compatible subset or EVEngine simplified format). Creates one TileLayer per tile layer; returns the first (nullptr on failure). Refreshes the module object cache from objectgroup layers.
 
int loadFromFile (const std::string &path)
 Same transactional replacement as newLayerFromFile, returning the published layer count.
 
eve::Result< int > loadFromFileWithObjectContract (const std::string &path, std::string_view contractJson)
 Parse a map and validate its objects before atomically publishing it.
 
eve::Result< int > loadFromTextWithObjectContract (std::string_view mapJson, std::string_view contractJson)
 Parse map JSON text and atomically publish it after object-contract admission.
 
void update (float dt)
 Updates .
 
void render (graphics::Graphics *gfx)
 Renders .
 
int pollConfigs ()
 Polls configs.
 
int getLastVisibleTileCount () const
 Last tile collection counters for project-owned diagnostics UIs.
 
int getLastCustomVisualCount () const
 Returns the last custom visual count.
 
int getLastAtlasCount () const
 Returns the last atlas count.
 
int getLastVisitedChunkCount () const
 Returns the last visited chunk count.
 
int getLastVisitedCellCount () const
 Returns the last visited cell count.
 
int publishCollision (TileLayer *layer)
 Generate merged collision from non-walkable tile metadata and notify adapters.
 
int getCollisionRectCount () const
 Returns the collision rect count.
 
float getCollisionRectX (int index) const
 Returns the collision rect x.
 
float getCollisionRectY (int index) const
 Returns the collision rect y.
 
float getCollisionRectWidth (int index) const
 Returns the collision rect width.
 
float getCollisionRectHeight (int index) const
 Returns the collision rect height.
 
int getLayerCount () const
 Returns the layer count.
 
TileLayer * getLayer (int index) const
 Layer created by the most recent loadFromFile/newLayerFromFile call.
 
int getObjectCount () const
 Returns the object count.
 
std::string getObjectName (int i) const
 Returns the object name.
 
std::string getObjectType (int i) const
 Returns the object type.
 
float getObjectX (int i) const
 Returns the object x.
 
float getObjectY (int i) const
 Returns the object y.
 
float getObjectWidth (int i) const
 Returns the object width.
 
float getObjectHeight (int i) const
 Returns the object height.
 
int getObjectGid (int i) const
 Returns the object gid.
 
int getObjectPropertyCount (int objectIndex) const
 Return the number of sorted custom properties on one cached object.
 
std::string getObjectPropertyName (int objectIndex, int propertyIndex) const
 Return an owning custom-property name at deterministic sorted position.
 
bool hasObjectProperty (int objectIndex, std::string_view name) const
 Query whether a cached object declares an exact custom-property name.
 
std::string getObjectProperty (int objectIndex, std::string_view name, std::string defaultValue={}) const
 Read the owning canonical text projection of an object's custom property.
 
std::optional< std::size_t > findObjectByName (std::string_view name) const
 Find the first loaded map object with an exact stable name.
 
std::optional< std::size_t > findObjectAt (float x, float y, std::string_view type={}) const
 Find the first loaded object containing a point, optionally filtered by type.
 
void setObjects (std::vector< MapObject > objects)
 Replace object cache (used by load / hot reload).
 
bool resolveDualGrid (TileLayer *logic, TileLayer *display)
 Dual-grid resolve: paint logic (filled/empty), fill display with 15-tile autotiles on a half-offset grid. See DualGrid.h. filledGid 0 = any non-zero logic cell counts as filled.
 
bool resolveDualGridFilled (TileLayer *logic, TileLayer *display, int filledGid)
 Resolve dual grid filled.
 
int dualGridMaskAt (TileLayer *logic, int dx, int dy, int filledGid)
 4-bit corner mask at display cell (dx,dy); see DualGrid.h.
 
int dualGridFrame (int mask)
 Default atlas frame for mask (-1 = empty).
 
float dualGridOffsetX (TileLayer *logic)
 Projection-correct half-step origin delta for a logic layer.
 
float dualGridOffsetY (TileLayer *logic)
 Dual grid offset y.
 
std::string lastDualGridError () const
 Last dual grid error.
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 

详细描述

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.

在文件 Map.h 第 30 行定义.

构造及析构函数说明

◆ Map()

eve::map::Map::Map ( )

Map.

在文件 Map.cpp 第 47 行定义.

引用了 eve::map::registerMapArtifactProvider().

◆ ~Map()

eve::map::Map::~Map ( )
overridedefault

Map.

成员函数说明

◆ dualGridFrame()

int eve::map::Map::dualGridFrame ( int  mask)

Default atlas frame for mask (-1 = empty).

在文件 Map.cpp 第 355 行定义.

引用了 eve::map::dualGridDefaultFrame() , 以及 mask.

◆ dualGridMaskAt()

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

4-bit corner mask at display cell (dx,dy); see DualGrid.h.

在文件 Map.cpp 第 350 行定义.

引用了 eve::map::dualGridMaskAt(), dx , 以及 dy.

◆ dualGridOffsetX()

float eve::map::Map::dualGridOffsetX ( TileLayer *  logic)

Projection-correct half-step origin delta for a logic layer.

在文件 Map.cpp 第 357 行定义.

引用了 eve::map::dualGridHalfOffset(), ox , 以及 oy.

◆ dualGridOffsetY()

float eve::map::Map::dualGridOffsetY ( TileLayer *  logic)

Dual grid offset y.

在文件 Map.cpp 第 364 行定义.

引用了 eve::map::dualGridHalfOffset(), ox , 以及 oy.

◆ findObjectAt()

std::optional< std::size_t > eve::map::Map::findObjectAt ( float  x,
float  y,
std::string_view  type = {} 
) const

Find the first loaded object containing a point, optionally filtered by type.

参数
xQuery coordinate in the same space as MapObject::x.
yQuery coordinate in the same space as MapObject::y.
typeExact object type, or empty to accept any type.
返回
Owning cache index when present, or nullopt when no object matches.
备注
Positive-size objects use an inclusive rectangle. Point objects require an exact finite coordinate match. The transient index has the same invalidation rules as findObjectByName. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks are invoked.

在文件 Map.cpp 第 323 行定义.

引用了 height, index, point, type, width, eve::map::MapObject::width, x , 以及 y.

◆ findObjectByName()

std::optional< std::size_t > eve::map::Map::findObjectByName ( std::string_view  name) const

Find the first loaded map object with an exact stable name.

参数
nameObject name to match; the input is borrowed only for this call.
返回
Owning cache index when present, or nullopt when no object matches.
备注
The index is a transient projection and may identify another object after loadFromFile, newLayerFromFile, hot reload, or setObjects. Persist object names, not indices. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks are invoked.

在文件 Map.cpp 第 317 行定义.

引用了 index , 以及 name.

◆ getCollisionRectCount()

int eve::map::Map::getCollisionRectCount ( ) const

Returns the collision rect count.

在文件 Map.cpp 第 173 行定义.

◆ getCollisionRectHeight()

float eve::map::Map::getCollisionRectHeight ( int  index) const

Returns the collision rect height.

在文件 Map.cpp 第 189 行定义.

引用了 index.

◆ getCollisionRectWidth()

float eve::map::Map::getCollisionRectWidth ( int  index) const

Returns the collision rect width.

在文件 Map.cpp 第 184 行定义.

引用了 index.

◆ getCollisionRectX()

float eve::map::Map::getCollisionRectX ( int  index) const

Returns the collision rect x.

在文件 Map.cpp 第 174 行定义.

引用了 index.

◆ getCollisionRectY()

float eve::map::Map::getCollisionRectY ( int  index) const

Returns the collision rect y.

在文件 Map.cpp 第 179 行定义.

引用了 index.

◆ getLastAtlasCount()

int eve::map::Map::getLastAtlasCount ( ) const

Returns the last atlas count.

在文件 Map.cpp 第 117 行定义.

引用了 eve::map::TileRenderSystem::lastAtlasCount().

◆ getLastCustomVisualCount()

int eve::map::Map::getLastCustomVisualCount ( ) const

Returns the last custom visual count.

在文件 Map.cpp 第 116 行定义.

引用了 eve::map::TileRenderSystem::lastCustomVisualCount().

◆ getLastVisibleTileCount()

int eve::map::Map::getLastVisibleTileCount ( ) const

Last tile collection counters for project-owned diagnostics UIs.

在文件 Map.cpp 第 115 行定义.

引用了 eve::map::TileRenderSystem::lastVisibleTileCount().

◆ getLastVisitedCellCount()

int eve::map::Map::getLastVisitedCellCount ( ) const

Returns the last visited cell count.

在文件 Map.cpp 第 119 行定义.

引用了 eve::map::TileRenderSystem::lastVisitedCellCount().

◆ getLastVisitedChunkCount()

int eve::map::Map::getLastVisitedChunkCount ( ) const

Returns the last visited chunk count.

在文件 Map.cpp 第 118 行定义.

引用了 eve::map::TileRenderSystem::lastVisitedChunkCount().

◆ getLayer()

TileLayer * eve::map::Map::getLayer ( int  index) const

Layer created by the most recent loadFromFile/newLayerFromFile call.

在文件 Map.cpp 第 203 行定义.

引用了 index.

◆ getLayerCount()

int eve::map::Map::getLayerCount ( ) const

Returns the layer count.

在文件 Map.cpp 第 195 行定义.

引用了 n , 以及 view.

◆ getObjectCount()

int eve::map::Map::getObjectCount ( ) const

Returns the object count.

在文件 Map.cpp 第 210 行定义.

◆ getObjectGid()

int eve::map::Map::getObjectGid ( int  i) const

Returns the object gid.

在文件 Map.cpp 第 242 行定义.

◆ getObjectHeight()

float eve::map::Map::getObjectHeight ( int  i) const

Returns the object height.

在文件 Map.cpp 第 237 行定义.

◆ getObjectName()

std::string eve::map::Map::getObjectName ( int  i) const

Returns the object name.

在文件 Map.cpp 第 212 行定义.

◆ getObjectProperty()

std::string eve::map::Map::getObjectProperty ( int  objectIndex,
std::string_view  name,
std::string  defaultValue = {} 
) const

Read the owning canonical text projection of an object's custom property.

参数
objectIndexTransient object-cache index.
nameExact property name borrowed only for this call.
defaultValueOwning default value returned when the object or property is absent.
返回
Owning property text or the supplied default; no reference into the reloadable cache escapes.
备注
Tiled scalar values are projected to canonical text at load admission. Consumers parse and validate domain-specific values before publishing gameplay state. Duplicate names keep the first value. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks are invoked.

在文件 Map.cpp 第 310 行定义.

引用了 defaultValue, name , 以及 properties.

◆ getObjectPropertyCount()

int eve::map::Map::getObjectPropertyCount ( int  objectIndex) const

Return the number of sorted custom properties on one cached object.

参数
objectIndexTransient object-cache index.
返回
Property count, or zero for an invalid object index.
备注
The count and subsequent property indices are invalidated whenever the object cache is replaced. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks are invoked.

在文件 Map.cpp 第 291 行定义.

引用了 properties.

◆ getObjectPropertyName()

std::string eve::map::Map::getObjectPropertyName ( int  objectIndex,
int  propertyIndex 
) const

Return an owning custom-property name at deterministic sorted position.

参数
objectIndexTransient object-cache index.
propertyIndexProperty position in [0, getObjectPropertyCount()).
返回
Owning property name, or an empty string for an invalid index.
备注
Property indices are transient; persist property names and stable object names instead. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks are invoked.

在文件 Map.cpp 第 296 行定义.

引用了 properties.

◆ getObjectType()

std::string eve::map::Map::getObjectType ( int  i) const

Returns the object type.

在文件 Map.cpp 第 217 行定义.

◆ getObjectWidth()

float eve::map::Map::getObjectWidth ( int  i) const

Returns the object width.

在文件 Map.cpp 第 232 行定义.

◆ getObjectX()

float eve::map::Map::getObjectX ( int  i) const

Returns the object x.

在文件 Map.cpp 第 222 行定义.

◆ getObjectY()

float eve::map::Map::getObjectY ( int  i) const

Returns the object y.

在文件 Map.cpp 第 227 行定义.

◆ hasObjectProperty()

bool eve::map::Map::hasObjectProperty ( int  objectIndex,
std::string_view  name 
) const

Query whether a cached object declares an exact custom-property name.

参数
objectIndexTransient object-cache index.
nameProperty name borrowed only for this call.
返回
True only for a valid object index with that property. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks are invoked.

在文件 Map.cpp 第 305 行定义.

引用了 name.

◆ lastDualGridError()

std::string eve::map::Map::lastDualGridError ( ) const

Last dual grid error.

在文件 Map.cpp 第 371 行定义.

◆ loadFromFile()

int eve::map::Map::loadFromFile ( const std::string &  path)

Same transactional replacement as newLayerFromFile, returning the published layer count.

返回
Positive published layer count, or zero with the previous map preserved on failure.

在文件 Map.cpp 第 90 行定义.

引用了 eve::map::loadMapFile(), path , 以及 setObjects().

◆ loadFromFileWithObjectContract()

eve::Result< int > eve::map::Map::loadFromFileWithObjectContract ( const std::string &  path,
std::string_view  contractJson 
)

Parse a map and validate its objects before atomically publishing it.

参数
pathMap JSON path borrowed for this call.
contractJsonVersioned eve.map.object-contract JSON borrowed for this call.
返回
Published layer count, or a structured failure with the prior map preserved. @ownership Published layers remain module-owned; path and contract text are not retained. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks or scripts are invoked.

在文件 Map.cpp 第 247 行定义.

引用了 eve::Applied, error, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::map::loadMapFile(), eve::ParseError, path, eve::Status::success(), eve::Result< T >::success() , 以及 eve::map::validateMapObjects().

◆ loadFromTextWithObjectContract()

eve::Result< int > eve::map::Map::loadFromTextWithObjectContract ( std::string_view  mapJson,
std::string_view  contractJson 
)

Parse map JSON text and atomically publish it after object-contract admission.

参数
mapJsonCandidate map document borrowed for this call.
contractJsonVersioned object contract borrowed for this call.
返回
Published layer count, or a structured failure with the prior map preserved. @ownership Candidate text is not retained; successful layers remain module-owned. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks or scripts are invoked.

在文件 Map.cpp 第 269 行定义.

引用了 eve::Applied, error, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::map::loadMapText(), eve::ParseError, eve::Status::success(), eve::Result< T >::success() , 以及 eve::map::validateMapObjects().

◆ Module_REG()

eve::map::Map::Module_REG ( Map  )

◆ newFov()

Fov * eve::map::Map::newFov ( TileLayer *  layer)

FOV bound to a TileLayer (syncs opacity from opaque GIDs).

在文件 Map.cpp 第 65 行定义.

引用了 layer.

◆ newFovSize()

Fov * eve::map::Map::newFovSize ( int  mapW,
int  mapH 
)

Custom grid FOV (no layer); fill with setOpaque.

在文件 Map.cpp 第 70 行定义.

◆ newFovVolume()

Fov * eve::map::Map::newFovVolume ( int  mapW,
int  mapH,
int  depth 
)

Volume FOV (W×H×D voxels); mode defaults to volume.

在文件 Map.cpp 第 75 行定义.

引用了 depth.

◆ newLayer()

TileLayer * eve::map::Map::newLayer ( int  mapW,
int  mapH,
float  tileW = 32.f,
float  tileH = 32.f 
)

Creates a layer. @ownership Caller deletes unless documented otherwise.

在文件 Map.cpp 第 51 行定义.

引用了 eve::map::TileLayer::createLayer(), tileH , 以及 tileW.

◆ newLayerFromFile()

TileLayer * eve::map::Map::newLayerFromFile ( const std::string &  path)

Load map JSON (Tiled-compatible subset or EVEngine simplified format). Creates one TileLayer per tile layer; returns the first (nullptr on failure). Refreshes the module object cache from objectgroup layers.

备注
Replacement is transactional at the module boundary: failure preserves the current layers and object cache; success clears and hides replaced layers before publishing the new cache. Returned layers are module-owned and remain borrowed until a later successful replacement or module teardown. @thread Call on the Map module's owning simulation thread. @reentrancy No callbacks are invoked.

在文件 Map.cpp 第 80 行定义.

引用了 eve::map::loadMapFile(), path , 以及 setObjects().

◆ newPathfinder()

Pathfinder * eve::map::Map::newPathfinder ( TileLayer *  layer)

Pathfinder bound to a TileLayer (syncs walkability from GIDs).

在文件 Map.cpp 第 55 行定义.

引用了 layer.

◆ newPathfinderSize()

Pathfinder * eve::map::Map::newPathfinderSize ( int  mapW,
int  mapH 
)

Custom grid pathfinder (no layer); fill with setBlocked / setCellCost.

在文件 Map.cpp 第 60 行定义.

◆ pollConfigs()

int eve::map::Map::pollConfigs ( )

Polls configs.

在文件 Map.cpp 第 113 行定义.

引用了 eve::map::TileConfigSystem::poll().

◆ publishCollision()

int eve::map::Map::publishCollision ( TileLayer *  layer)

Generate merged collision from non-walkable tile metadata and notify adapters.

在文件 Map.cpp 第 121 行定义.

引用了 layer, eve::map::Orthogonal, shape, eve::map::tileGid(), tiles, v, x , 以及 y.

◆ render()

◆ resolveDualGrid()

bool eve::map::Map::resolveDualGrid ( TileLayer *  logic,
TileLayer *  display 
)

Dual-grid resolve: paint logic (filled/empty), fill display with 15-tile autotiles on a half-offset grid. See DualGrid.h. filledGid 0 = any non-zero logic cell counts as filled.

在文件 Map.cpp 第 337 行定义.

引用了 ok , 以及 eve::map::resolveDualGrid().

◆ resolveDualGridFilled()

bool eve::map::Map::resolveDualGridFilled ( TileLayer *  logic,
TileLayer *  display,
int  filledGid 
)

Resolve dual grid filled.

在文件 Map.cpp 第 343 行定义.

引用了 eve::map::DualGridOptions::filledGid, ok , 以及 eve::map::resolveDualGrid().

◆ setObjects()

void eve::map::Map::setObjects ( std::vector< MapObject >  objects)

Replace object cache (used by load / hot reload).

在文件 Map.cpp 第 208 行定义.

被这些函数引用 loadFromFile() , 以及 newLayerFromFile().

◆ update()

void eve::map::Map::update ( float  dt)

Updates .

在文件 Map.cpp 第 100 行定义.

引用了 eve::map::TileConfigSystem::poll() , 以及 eve::map::TileRenderSystem::update().


该类的文档由以下文件生成: