Last active
December 24, 2015 13:59
-
-
Save Ratstail91/6808867 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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