Spirit parser to load simple 2D maps.

This commit is contained in:
King_DuckZ 2014-12-13 04:50:23 +01:00
parent bd241bbbd2
commit e17f77ae05
5 changed files with 111 additions and 4 deletions

View file

@ -8,10 +8,15 @@ int main() {
typedef dk::Tyler<2> Tiler;
typedef std::unique_ptr<std::ifstream> ifstreamptr;
Tiler tiler(Tiler::coords(8, 6), Tiler::coords(64));
Tiler tiler(Tiler::coords(10, 6), Tiler::coords(64));
auto bottom_layer = &tiler.push_layer<int>(dk::Layer<int, 2>::streamer_type(ifstreamptr(new std::ifstream(DATA_PATH"test.map"))));
tiler.push_layer<char>(dk::Layer<char, 2>::streamer_type(ifstreamptr(new std::ifstream(DATA_PATH"test_2.map"))));
const std::string map1(DATA_PATH"/test.map");
const std::string map2(DATA_PATH"/test_2.map");
std::cout << "Loading " << map1 << '\n';
auto bottom_layer = &tiler.push_layer<int>(dk::Layer<int, 2>::streamer_type(ifstreamptr(new std::ifstream(map1))));
std::cout << "Loading " << map2 << '\n';
tiler.push_layer<char>(dk::Layer<char, 2>::streamer_type(ifstreamptr(new std::ifstream(map2))), dk::Vector<int, 2>(2));
{
auto ittest = bottom_layer->begin();