From e3fd07e606098dd9cdf0b7ed806340d8466b5572 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Sun, 11 Feb 2018 22:55:22 +0100 Subject: Reimplement in C++ with SFML (mostly) --- src/main/cpp/Map.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/cpp/Map.cpp (limited to 'src/main/cpp/Map.cpp') diff --git a/src/main/cpp/Map.cpp b/src/main/cpp/Map.cpp new file mode 100644 index 0000000..6d3ee01 --- /dev/null +++ b/src/main/cpp/Map.cpp @@ -0,0 +1,28 @@ +#include "Map.hpp" + +// TODO remove hardcoded values +Map::Map() : width(50), height(50) +{ + for (unsigned i = 0; i < width; i++) { + for (unsigned j = 0; j < height; j++) { + // TODO remove hardcoded values (grass) + Tile tile(Tile::Type::GRASS, i, j); + _tiles.push_back(tile); + } + } +} + +Tile& Map::tile(unsigned x, unsigned y) +{ + return _tiles[y * width + x]; +} + +const std::vector& Map::tiles() const +{ + return _tiles; +} + +bool Map::moveActor(Tile &from, Tile &to) +{ + // TODO +} -- cgit v1.2.1