![]() |
Gamedev Framework (gf) 1.2.0
A C++17 framework for 2D games
|
A two-dimensional array with no data. More...
#include <gf/Array2D.h>
Public Member Functions | |
Index2D () | |
Default constructor. More... | |
Index2D (Vector< I, 2 > size) | |
Constructor with a size. More... | |
Index2D (const Index2D &)=default | |
Default copy constructor. More... | |
Index2D & | operator= (const Index2D &)=default |
Default copy assignment. More... | |
Index2D (Index2D &&)=default | |
Default move constructor. More... | |
Index2D & | operator= (Index2D &&)=default |
Default move assignement. More... | |
void | swap (Index2D &other) |
Swap with another array. More... | |
Size and position | |
constexpr Vector< I, 2 > | getSize () const noexcept |
Get the size of the array. More... | |
constexpr I | getCols () const noexcept |
Get the number of columns. More... | |
constexpr I | getRows () const noexcept |
Get the number of rows. More... | |
constexpr bool | isValid (Vector< I, 2 > pos) const noexcept |
Check if a position is valid. More... | |
constexpr Vector< I, 2 > | toPosition (std::size_t index) const noexcept |
Transform a 1D position into a 2D position. More... | |
constexpr std::size_t | toIndex (Vector< I, 2 > pos) const noexcept |
Transform a 2D position into a 1D position. More... | |
Ranges | |
constexpr RangeZ | getIndexRange () const noexcept |
Get the 1D index range of the array. More... | |
constexpr Range< I > | getRowRange () const noexcept |
Get the row range. More... | |
constexpr Range< I > | getColRange () const noexcept |
Get the column range. More... | |
constexpr PositionRange< I > | getPositionRange () const noexcept |
Get the position range. More... | |
NeighborSquareRange< I > | get8NeighborsRange (Vector< I, 2 > pos) const noexcept |
Get a range for 8 neighbors (at most) More... | |
NeighborSquareRange< I > | get24NeighborsRange (Vector< I, 2 > pos) const noexcept |
Get a range for 24 neighbors (at most) More... | |
NeighborDiamondRange< I > | get4NeighborsRange (Vector< I, 2 > pos) const noexcept |
Get a range for 4 neighbors (at most) More... | |
NeighborDiamondRange< I > | get12NeighborsRange (Vector< I, 2 > pos) const noexcept |
Get a range for 12 neighbors (at most) More... | |
A two-dimensional array with no data.
You probably want to use gf::Array2D
|
inline |
Default constructor.
Creates an empty array.
|
inline |
Constructor with a size.
size | The size of the array |
|
default |
Default copy constructor.
|
default |
Default move constructor.
|
inlinenoexcept |
Get a range for 12 neighbors (at most)
pos | The base position |
|
inlinenoexcept |
Get a range for 24 neighbors (at most)
pos | The base position |
|
inlinenoexcept |
Get a range for 4 neighbors (at most)
pos | The base position |
|
inlinenoexcept |
Get a range for 8 neighbors (at most)
pos | The base position |
|
inlineconstexprnoexcept |
Get the column range.
|
inlineconstexprnoexcept |
Get the number of columns.
|
inlineconstexprnoexcept |
Get the 1D index range of the array.
|
inlineconstexprnoexcept |
Get the position range.
|
inlineconstexprnoexcept |
Get the row range.
|
inlineconstexprnoexcept |
Get the number of rows.
|
inlineconstexprnoexcept |
Get the size of the array.
|
inlineconstexprnoexcept |
Check if a position is valid.
A valid position is a position inside the array
|
default |
Default copy assignment.
|
default |
Default move assignement.
|
inline |
Swap with another array.
other | An other array |
|
inlineconstexprnoexcept |
Transform a 2D position into a 1D position.
pos | A 2D position |
|
inlineconstexprnoexcept |
Transform a 1D position into a 2D position.
index | A 1D position |