Created
December 10, 2014 23:32
-
-
Save Nunocky/8614b228cde33a26c932 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
void calcWorldSize() { | |
final float screenRatio = ((float)Gdx.graphics.getWidth()) / Gdx.graphics.getHeight(); | |
final float worldRatio = W / H; | |
if (screenRatio > worldRatio) { | |
worldBottomLeft.y = 0; | |
worldTopRight.y = H; | |
float w = screenRatio * H; | |
worldBottomLeft.x = - (w - W)/2; | |
worldTopRight.x = W + (w - W)/2; | |
} | |
else { | |
worldBottomLeft.x = 0; | |
worldTopRight.x = W; | |
float h = W / screenRatio; | |
worldBottomLeft.y = - (h - H)/2; | |
worldTopRight.y = H + (h - H)/2; | |
} | |
Gdx.app.log(TAG, "worldBottomLeft : " + worldBottomLeft.toString()); | |
Gdx.app.log(TAG, "worldTopRight : " + worldTopRight.toString()); | |
worldWidth = worldTopRight.x - worldBottomLeft.x; | |
worldHeight = worldTopRight.y - worldBottomLeft.y; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment