diff options
author | HampusM <hampus@hampusmat.com> | 2022-02-27 17:12:49 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:56:53 +0200 |
commit | fe79577396231f2edb7927f1f61ce814f03851a7 (patch) | |
tree | d353a1caa449ec772dcf9a8681084fc2d6e64116 /src/engine/graphics/string_matrix.hpp | |
parent | 6964d48c970e5f7b11897096c816271785af23ac (diff) |
add basic engine graphics
Diffstat (limited to 'src/engine/graphics/string_matrix.hpp')
-rw-r--r-- | src/engine/graphics/string_matrix.hpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/engine/graphics/string_matrix.hpp b/src/engine/graphics/string_matrix.hpp new file mode 100644 index 0000000..662ea7b --- /dev/null +++ b/src/engine/graphics/string_matrix.hpp @@ -0,0 +1,60 @@ +#pragma once + +#include "interfaces/bounds.hpp" +#include "interfaces/matrix.hpp" +#include "interfaces/vector2.hpp" + +#include <string_view> +#include <vector> + +/** + * A Matrix. + */ +class StringMatrix : public IMatrix<std::string_view> +{ +public: + /** + * Creates a matrix. + * + * @param bounds The bounds of the matrix + */ + explicit StringMatrix(const IBounds &bounds); + + /** + * Fills the matrix with a element. + * + * @param element A element + */ + void fill(std::string_view element) override; + + /** + * Returns a element of the matrix. + * + * @param pos The position of a element + */ + [[nodiscard]] std::string_view get(const IVector2 &pos) const override; + + /** + * Sets a element of the matrix. + * + * @param pos The position of a element + * @param element A new element + */ + void set(const IVector2 &pos, std::string_view element) override; + + /** + * Returns the number of rows the matrix has. + */ + [[nodiscard]] unsigned int rows() const override; + + /** + * Returns the number of columns the matrix has. + */ + [[nodiscard]] unsigned int columns() const override; + +private: + std::vector<std::vector<std::string_view>> _matrix; + + unsigned int _rows; + unsigned int _columns; +}; |