2014-12-12 19:04:48 +00:00
|
|
|
#include "doorkeeper.hpp"
|
|
|
|
#include "doorkeeperConfig.h"
|
2014-08-27 14:03:56 +00:00
|
|
|
#include <iostream>
|
2014-12-09 22:53:09 +00:00
|
|
|
#include <fstream>
|
|
|
|
#include <memory>
|
2014-08-27 14:03:56 +00:00
|
|
|
|
|
|
|
int main() {
|
2014-12-09 22:53:09 +00:00
|
|
|
typedef dk::Tyler<2> Tiler;
|
2014-12-11 22:58:52 +00:00
|
|
|
typedef std::unique_ptr<std::ifstream> ifstreamptr;
|
2014-12-09 21:30:06 +00:00
|
|
|
|
2014-12-13 03:50:23 +00:00
|
|
|
Tiler tiler(Tiler::coords(10, 6), Tiler::coords(64));
|
2014-12-12 19:04:48 +00:00
|
|
|
|
2014-12-13 03:50:23 +00:00
|
|
|
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))));
|
2014-12-14 12:13:10 +00:00
|
|
|
//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));
|
2014-12-09 22:53:09 +00:00
|
|
|
|
2014-12-14 12:13:10 +00:00
|
|
|
dk::Viewport<2> viewport(tiler, Tiler::coords(0), Tiler::coords(10, 6));
|
|
|
|
dk::Viewport<2> viewport_small(tiler, Tiler::coords(1), Tiler::coords(9, 5));
|
2014-12-12 19:04:48 +00:00
|
|
|
{
|
2014-12-14 12:13:10 +00:00
|
|
|
int col = 0;
|
|
|
|
const auto tilecount = bottom_layer->count();
|
|
|
|
for (auto tile : *bottom_layer) {
|
|
|
|
std::cout << tile;
|
|
|
|
++col;
|
|
|
|
if (col == tilecount.x()) {
|
|
|
|
col = 0;
|
|
|
|
std::cout << '\n';
|
|
|
|
}
|
2014-12-12 19:04:48 +00:00
|
|
|
}
|
|
|
|
}
|
2014-12-09 22:53:09 +00:00
|
|
|
|
|
|
|
#if !defined(NDEBUG)
|
|
|
|
std::cout << "Map size: " << tiler.map_size() << '\n';
|
|
|
|
#endif
|
|
|
|
std::cout << "Total tiles: " << tiler.tiles_count() << '\n';
|
2014-08-27 14:03:56 +00:00
|
|
|
return 0;
|
|
|
|
}
|