diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-13 19:55:53 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-02-13 19:55:53 +0100 |
commit | b0c265ee3d94921f55266a679d3801a4d2b4505b (patch) | |
tree | b489dcbafddafdb05b415e920e9a2ca8524158e6 /src/matrix.tpp | |
parent | 36ce8d5d2c9b3bb9588a2bc1d96ee2678c2b990c (diff) |
refactor: move some components to a engine dir
Diffstat (limited to 'src/matrix.tpp')
-rw-r--r-- | src/matrix.tpp | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/matrix.tpp b/src/matrix.tpp deleted file mode 100644 index b9fa495..0000000 --- a/src/matrix.tpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "matrix.hpp" -#include <iostream> - -template <typename Element> -Matrix<Element>::Matrix(unsigned int rows, unsigned int columns) -{ - _rows = rows; - _columns = columns; - - _matrix.reserve(rows); - _matrix.assign(_matrix.capacity(), std::vector<Element>(columns)); -}; - -template <typename Element> -void Matrix<Element>::fill(Element element) -{ - for (unsigned int row = 0U; row < _matrix.capacity(); row++) - { - std::vector<Element> row_vector = _matrix[row]; - - for (unsigned int column = 0U; column < row_vector.capacity(); column++) - _matrix[row][column] = element; - } -} - -template <typename Element> -void Matrix<Element>::print() -{ - for (std::vector<Element> row : _matrix) - { - for (Element element : row) - std::cout << element; - - std::cout << "\n"; - } - - std::cout << std::flush; -} - -template <typename Element> -Element Matrix<Element>::get(Vector2 pos) -{ - return _matrix[pos.y()][pos.x()]; -} - -template <typename Element> -void Matrix<Element>::set(Vector2 pos, Element element) -{ - _matrix[pos.y()][pos.x()] = element; -} - -template <typename Element> -unsigned int Matrix<Element>::rows() -{ - return _rows; -} - -template <typename Element> -unsigned int Matrix<Element>::columns() -{ - return _columns; -} |