I can iterate through tiles using viewports.
This commit is contained in:
parent
e17f77ae05
commit
7bf96669a5
9 changed files with 119 additions and 41 deletions
21
src/main.cpp
21
src/main.cpp
|
@ -15,16 +15,21 @@ int main() {
|
|||
|
||||
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));
|
||||
//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));
|
||||
|
||||
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));
|
||||
{
|
||||
auto ittest = bottom_layer->begin();
|
||||
for (int z = 0; z < 10; ++z) {
|
||||
#if !defined(NDEBUG)
|
||||
std::cout << "At tile " << ittest.position() << " value " << *ittest << '\n';
|
||||
#endif
|
||||
++ittest;
|
||||
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';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue