feat: Add dynamic layer system for Grid (closes #147)
Implements ColorLayer and TileLayer classes with z_index ordering: - ColorLayer: stores RGBA color per cell for overlays, fog of war, etc. - TileLayer: stores sprite index per cell with optional texture - z_index < 0: renders below entities - z_index >= 0: renders above entities Python API: - grid.add_layer(type, z_index, texture) - create layer - grid.remove_layer(layer) - remove layer - grid.layers - list of layers sorted by z_index - grid.layer(z_index) - get layer by z_index - layer.at(x,y) / layer.set(x,y,value) - cell access - layer.fill(value) - fill entire layer Layers are allocated separately from UIGridPoint, reducing memory for grids that don't need all features. Base grid retains walkable/ transparent arrays for TCOD pathfinding. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f769c6c5f5
commit
4b05a95efe
6 changed files with 1342 additions and 19 deletions
|
|
@ -15,6 +15,7 @@
|
|||
#include "UILine.h"
|
||||
#include "UICircle.h"
|
||||
#include "UIArc.h"
|
||||
#include "GridLayers.h"
|
||||
#include "Resources.h"
|
||||
#include "PyScene.h"
|
||||
#include <filesystem>
|
||||
|
|
@ -303,6 +304,9 @@ PyObject* PyInit_mcrfpy()
|
|||
/*game map & perspective data*/
|
||||
&PyUIGridPointType, &PyUIGridPointStateType,
|
||||
|
||||
/*grid layers (#147)*/
|
||||
&PyColorLayerType, &PyTileLayerType,
|
||||
|
||||
/*collections & iterators*/
|
||||
&PyUICollectionType, &PyUICollectionIterType,
|
||||
&PyUIEntityCollectionType, &PyUIEntityCollectionIterType,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue