Created
July 28, 2022 08:17
-
-
Save KartikShrivastava/760f1f0828e6d6066d8a2f998f32e8e0 to your computer and use it in GitHub Desktop.
This file contains 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
unsigned int nHoriTiles = resNode->room().width(); | |
unsigned int nVertTiles = resNode->room().height(); | |
unsigned int tileWidthPixels = resNode->room().hsnap(); | |
unsigned int tileHeightPixels = resNode->room().vsnap(); | |
if(resNode->mutable_room()->orientation() == "hexagonal") { | |
hexMapUtil = std::make_unique<HexMapUtil>(); | |
hexMapUtil->hexSideLength = resNode->room().hexsidelength(); | |
hexMapUtil->staggerAxis = resNode->room().staggeraxis(); | |
hexMapUtil->staggerIndex = resNode->room().staggerindex(); | |
if(hexMapUtil->staggerAxis == "x") { | |
resNode->mutable_room()->set_width((3 * nHoriTiles + 1) * hexMapUtil->hexSideLength / 2); | |
resNode->mutable_room()->set_height((nVertTiles * tileHeightPixels) + hexMapUtil->hexSideLength); | |
} | |
else { | |
resNode->mutable_room()->set_width((nHoriTiles * tileWidthPixels) + hexMapUtil->hexSideLength); | |
resNode->mutable_room()->set_height((3 * nVertTiles + 1) * hexMapUtil->hexSideLength / 2); | |
} | |
} | |
else { | |
resNode->mutable_room()->set_width(nHoriTiles * tileWidthPixels); | |
resNode->mutable_room()->set_height(nVertTiles * tileHeightPixels); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment