Camera implemented
This commit is contained in:
34
src/engine/utility/grid2d.hpp
Normal file
34
src/engine/utility/grid2d.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// Created by m on 12/11/21.
|
||||
//
|
||||
|
||||
#ifndef RLA_IIPP_GRID2D_HPP
|
||||
#define RLA_IIPP_GRID2D_HPP
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
template<typename T>
|
||||
class Grid2D {
|
||||
private:
|
||||
std::vector<std::vector<T>> grid{};
|
||||
public:
|
||||
Grid2D(int width, int height) {
|
||||
grid = std::vector<std::vector<T>>(height, std::vector<T>(width));
|
||||
}
|
||||
int get_width() {
|
||||
return grid[0].size();
|
||||
}
|
||||
int get_height() {
|
||||
return grid.size();
|
||||
}
|
||||
void insert(int x, int y, T arg) {
|
||||
grid[y][x] = arg;
|
||||
}
|
||||
T get(int x, int y) {
|
||||
return grid[y][x];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif //RLA_IIPP_GRID2D_HPP
|
||||
Reference in New Issue
Block a user