diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-04 14:25:00 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-01-04 14:25:00 +0100 |
commit | bbfcfe50daa7a354d0a723194200dba1e77228ef (patch) | |
tree | d2d7b8fe8ec6e856719128549ef9c461cdae67be /core/math/a_star_grid_2d.h | |
parent | 1aa03f7701603341a4ffb734919117b4ca0d7b05 (diff) | |
parent | 04bb89c0bd963c2df6bec4d0d97457b3ba41faaa (diff) | |
download | redot-engine-bbfcfe50daa7a354d0a723194200dba1e77228ef.tar.gz |
Merge pull request #81267 from Chaosus/astargrid_isometric_mode
Add isometric cell shape mode to `AStarGrid2D`.
Diffstat (limited to 'core/math/a_star_grid_2d.h')
-rw-r--r-- | core/math/a_star_grid_2d.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/math/a_star_grid_2d.h b/core/math/a_star_grid_2d.h index 619551b754..69cb77dd3e 100644 --- a/core/math/a_star_grid_2d.h +++ b/core/math/a_star_grid_2d.h @@ -56,11 +56,19 @@ public: HEURISTIC_MAX, }; + enum CellShape { + CELL_SHAPE_SQUARE, + CELL_SHAPE_ISOMETRIC_RIGHT, + CELL_SHAPE_ISOMETRIC_DOWN, + CELL_SHAPE_MAX, + }; + private: Rect2i region; Vector2 offset; Size2 cell_size = Size2(1, 1); bool dirty = false; + CellShape cell_shape = CELL_SHAPE_SQUARE; bool jumping_enabled = false; DiagonalMode diagonal_mode = DIAGONAL_MODE_ALWAYS; @@ -157,6 +165,9 @@ public: void set_cell_size(const Size2 &p_cell_size); Size2 get_cell_size() const; + void set_cell_shape(CellShape p_cell_shape); + CellShape get_cell_shape() const; + void update(); bool is_in_bounds(int32_t p_x, int32_t p_y) const; @@ -193,5 +204,6 @@ public: VARIANT_ENUM_CAST(AStarGrid2D::DiagonalMode); VARIANT_ENUM_CAST(AStarGrid2D::Heuristic); +VARIANT_ENUM_CAST(AStarGrid2D::CellShape) #endif // A_STAR_GRID_2D_H |