Skip to content

Instantly share code, notes, and snippets.

@Ratstail91
Last active December 24, 2015 13:59
Show Gist options
  • Save Ratstail91/6808867 to your computer and use it in GitHub Desktop.
Save Ratstail91/6808867 to your computer and use it in GitHub Desktop.
int main(int, char**) {
try {
//set up
RegionPager pager;
pager.SetWidth(40*32);
pager.SetHeight(40*32);
pager.SetOnNew([](Region* const ptr){
printf("(%d, %d)\n", ptr->GetX(), ptr->GetY());
});
pager.SetOnDelete([](Region* const ptr){
for (auto& i : *ptr->GetTiles()) {
printf("{%d, %d, %d}\n", i.x, i.y, i.depth);
}
});
//create
pager.NewRegion(40*32*0, 40*32*0);
pager.NewRegion(40*32*1, 40*32*0);
pager.NewRegion(40*32*0, 40*32*1);
pager.NewRegion(40*32*1, 40*32*1);
//test
Region* ptr = pager.GetRegion(40*32*0, 40*32*1);
ptr->NewTileR({32*0, 32*0, 0, 32, 32, 50});
ptr->NewTileR({32*1, 32*0, 0, 32, 32, 50});
ptr->NewTileR({32*0, 32*1, 0, 32, 32, 50});
ptr->NewTileR({32*1, 32*1, 0, 32, 32, 50});
}
catch(exception& e) {
cerr << "Fatal Error: " << e.what() << endl;
return 1;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment