![]() |
FastEngine 0.9.4
A multiplayer oriented 2D engine made with Vulkan.
|
A container to store a 2D matrix of any type. More...
#include <C_matrix.hpp>
Public Types | |
| using | iterator = T* |
| using | const_iterator = T const* |
Public Member Functions | |
| Matrix () | |
| Construct a empty matrix. | |
| Matrix (std::initializer_list< std::initializer_list< T > > data) | |
| Construct a matrix with a initializer list. | |
| template<class Tvec> | |
| Matrix (fge::Vector2< Tvec > const &msize) | |
| Construct a matrix with a certain size. | |
| Matrix (std::size_t sizex, std::size_t sizey) | |
| Construct a matrix with a certain size. | |
| template<class Tvec> | |
| Matrix (fge::Vector2< Tvec > const &msize, T const &defaultValue) | |
| Construct a matrix with a certain size and a default value. | |
| Matrix (std::size_t sizex, std::size_t sizey, T const &defaultValue) | |
| Construct a matrix with a certain size and a default value. | |
| Matrix (fge::Matrix< T > const &m) | |
| Matrix (fge::Matrix< T > &&m) noexcept | |
| void | clear () |
| Clear the matrix and set the size to 0,0. | |
| fge::Matrix< T > & | operator= (fge::Matrix< T > const &m) |
| fge::Matrix< T > & | operator= (fge::Matrix< T > &&m) noexcept |
| T * | operator[] (std::size_t x) |
| Get the specified row. | |
| T const * | operator[] (std::size_t x) const |
| T const & | get (std::size_t x, std::size_t y) const |
| Get the specified value. | |
| template<class Tvec> | |
| T const & | get (fge::Vector2< Tvec > const &coord) const |
| Get the specified value. | |
| T & | get (std::size_t x, std::size_t y) |
| template<class Tvec> | |
| T & | get (fge::Vector2< Tvec > const &coord) |
| bool | get (std::size_t x, std::size_t y, T &buff) const |
| Get the specified value without throwing an exception. | |
| template<class Tvec> | |
| bool | get (fge::Vector2< Tvec > const &coord, T &buff) const |
| Get the specified value without throwing an exception. | |
| T * | getPtr (std::size_t x, std::size_t y) |
| Get the specified value as a pointer. | |
| template<class Tvec> | |
| T * | getPtr (fge::Vector2< Tvec > const &coord) |
| Get the specified value as a pointer. | |
| T const * | getPtr (std::size_t x, std::size_t y) const |
| template<class Tvec> | |
| T const * | getPtr (fge::Vector2< Tvec > const &coord) const |
| void | set (std::size_t x, std::size_t y, T &&value) |
| Set the specified value by moving it. | |
| template<class Tvec> | |
| void | set (fge::Vector2< Tvec > const &coord, T &&value) |
| Set the specified value by moving it. | |
| void | set (std::size_t x, std::size_t y, T const &value) |
| Set the specified value by copying it. | |
| template<class Tvec> | |
| void | set (fge::Vector2< Tvec > const &coord, T const &value) |
| Set the specified value by copying it. | |
| void | set (std::initializer_list< std::initializer_list< T > > data) |
| Set values with a initializer list. | |
| std::size_t | getTotalSize () const |
| Get the total number of elements in the matrix. | |
| fge::Vector2< std::size_t > const & | getSize () const |
| Get the size of the matrix as a vector2. | |
| std::size_t | getSizeX () const |
| Get the x size of the matrix. | |
| std::size_t | getSizeY () const |
| Get the y size of the matrix. | |
| T const * | get () const |
| Get the 2D array of the matrix. | |
| T * | get () |
| fge::Matrix< T >::iterator | begin () |
| fge::Matrix< T >::iterator | end () |
| fge::Matrix< T >::const_iterator | begin () const |
| fge::Matrix< T >::const_iterator | end () const |
| template<class Tvec> | |
| void | setSize (fge::Vector2< Tvec > const &msize) |
| Set the size of the matrix. | |
| void | setSize (std::size_t sizex, std::size_t sizey) |
| Set the size of the matrix. | |
| void | fill (T const &value) |
| Fill the matrix by copying a value. | |
| void | rotateClockwise () |
| Rotate the matrix by 90 degrees clockwise. | |
| void | rotateCounterClockwise () |
| Rotate the matrix by 90 degrees counter-clockwise. | |
| void | rotateClockwise (unsigned int n) |
| Rotate the matrix by 90 degrees clockwise and n times. | |
| void | rotateCounterClockwise (unsigned int n) |
| Rotate the matrix by 90 degrees counter-clockwise and n times. | |
| void | flipHorizontally () |
| Flip the matrix horizontally. | |
| void | flipVertically () |
| Flip the matrix vertically. | |
| void | toVector (std::vector< T > &buff) const |
| Insert all elements of the matrix in a 1D vector. | |
| template<class Tvec> | |
| T const & | get (fge::Vector2< Tvec > const &coord) const |
| template<class Tvec> | |
| T const * | getPtr (fge::Vector2< Tvec > const &coord) const |
A container to store a 2D matrix of any type.
| T | The type of the matrix |
| fge::Matrix< T >::Matrix | ( | ) |
Construct a empty matrix.
| fge::Matrix< T >::Matrix | ( | std::initializer_list< std::initializer_list< T > > | data | ) |
Construct a matrix with a initializer list.
Make sure that the number of elements in a row is the same to all other rows.
| data | The initializer list |
|
explicit |
Construct a matrix with a certain size.
| Tvec | The type of the vector |
| msize | The size of the matrix |
| fge::Matrix< T >::Matrix | ( | std::size_t | sizex, |
| std::size_t | sizey ) |
Construct a matrix with a certain size.
| sizex | The size of the matrix on the x axis |
| sizey | The size of the matrix on the y axis |
| fge::Matrix< T >::Matrix | ( | fge::Vector2< Tvec > const & | msize, |
| T const & | defaultValue ) |
Construct a matrix with a certain size and a default value.
| Tvec | The type of the vector |
| msize | The size of the matrix |
| defaultValue | The value to fill the matrix with |
| fge::Matrix< T >::Matrix | ( | std::size_t | sizex, |
| std::size_t | sizey, | ||
| T const & | defaultValue ) |
Construct a matrix with a certain size and a default value.
| sizex | The size of the matrix on the x axis |
| sizey | The size of the matrix on the y axis |
| defaultValue | The value to fill the matrix with |
| void fge::Matrix< T >::clear | ( | ) |
Clear the matrix and set the size to 0,0.
| void fge::Matrix< T >::fill | ( | T const & | value | ) |
Fill the matrix by copying a value.
| value | The value to copy |
| void fge::Matrix< T >::flipHorizontally | ( | ) |
Flip the matrix horizontally.
| void fge::Matrix< T >::flipVertically | ( | ) |
Flip the matrix vertically.
|
inlinenodiscard |
Get the 2D array of the matrix.
|
inline |
Get the specified value.
| Tvec | The type of the vector |
| coord | The coordinates of the value |
| bool fge::Matrix< T >::get | ( | fge::Vector2< Tvec > const & | coord, |
| T & | buff ) const |
Get the specified value without throwing an exception.
| Tvec | The type of the vector |
| coord | The coordinates of the value |
| buff | The value to store the result in |
|
inline |
Get the specified value.
| x | The x index of the value |
| y | The y index of the value |
| bool fge::Matrix< T >::get | ( | std::size_t | x, |
| std::size_t | y, | ||
| T & | buff ) const |
Get the specified value without throwing an exception.
| x | The x index of the value |
| y | The y index of the value |
| buff | The value to store the result in |
| T * fge::Matrix< T >::getPtr | ( | fge::Vector2< Tvec > const & | coord | ) |
Get the specified value as a pointer.
| Tvec | The type of the vector |
| coord | The coordinates of the value |
| T * fge::Matrix< T >::getPtr | ( | std::size_t | x, |
| std::size_t | y ) |
Get the specified value as a pointer.
| x | The x index of the value |
| y | The y index of the value |
|
inlinenodiscard |
Get the size of the matrix as a vector2.
|
inlinenodiscard |
Get the x size of the matrix.
|
inlinenodiscard |
Get the y size of the matrix.
|
inlinenodiscard |
Get the total number of elements in the matrix.
|
inline |
Get the specified row.
| x | The index of the row |
| void fge::Matrix< T >::rotateClockwise | ( | ) |
Rotate the matrix by 90 degrees clockwise.
| void fge::Matrix< T >::rotateClockwise | ( | unsigned int | n | ) |
Rotate the matrix by 90 degrees clockwise and n times.
| n | The number of times to rotate |
| void fge::Matrix< T >::rotateCounterClockwise | ( | ) |
Rotate the matrix by 90 degrees counter-clockwise.
| void fge::Matrix< T >::rotateCounterClockwise | ( | unsigned int | n | ) |
Rotate the matrix by 90 degrees counter-clockwise and n times.
| n | The number of times to rotate |
| void fge::Matrix< T >::set | ( | fge::Vector2< Tvec > const & | coord, |
| T && | value ) |
Set the specified value by moving it.
| Tvec | The type of the vector |
| coord | The coordinates of the value |
| value | The value to move |
| void fge::Matrix< T >::set | ( | fge::Vector2< Tvec > const & | coord, |
| T const & | value ) |
Set the specified value by copying it.
| Tvec | The type of the vector |
| coord | The coordinates of the value |
| value | The value to copy |
| void fge::Matrix< T >::set | ( | std::initializer_list< std::initializer_list< T > > | data | ) |
Set values with a initializer list.
The size of the matrix will be set to the size of the provided list.
| data | The initializer list |
| void fge::Matrix< T >::set | ( | std::size_t | x, |
| std::size_t | y, | ||
| T && | value ) |
Set the specified value by moving it.
| x | The x index of the value |
| y | The y index of the value |
| value | The value to move |
| void fge::Matrix< T >::set | ( | std::size_t | x, |
| std::size_t | y, | ||
| T const & | value ) |
Set the specified value by copying it.
| x | The x index of the value |
| y | The y index of the value |
| value | The value to copy |
| void fge::Matrix< T >::setSize | ( | fge::Vector2< Tvec > const & | msize | ) |
Set the size of the matrix.
| Tvec | The type of the vector |
| msize | The size of the matrix |
| void fge::Matrix< T >::setSize | ( | std::size_t | sizex, |
| std::size_t | sizey ) |
Set the size of the matrix.
| sizex | The x size of the matrix |
| sizey | The y size of the matrix |
| void fge::Matrix< T >::toVector | ( | std::vector< T > & | buff | ) | const |
Insert all elements of the matrix in a 1D vector.
| buff | The vector to insert the elements in |