1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-11-15 22:19:07 +00:00

Fix camera constrain logic for very wide resolutions.

This affected all standard wide resolutions too, but wasn't noticed
because the camera wasn't positioned very far off.
This commit is contained in:
fgenesis 2012-09-21 01:28:25 +02:00
parent eaa7c27f82
commit dec7707562

View file

@ -9925,8 +9925,8 @@ void Game::constrainCamera()
cameraOffBounds = 0; cameraOffBounds = 0;
if (cameraConstrained) if (cameraConstrained)
{ {
int vw2 = core->getVirtualOffX()*core->invGlobalScale; float vw2 = core->getVirtualOffX()*core->invGlobalScale;
int vh2 = core->getVirtualOffY()*core->invGlobalScale; float vh2 = core->getVirtualOffY()*core->invGlobalScale;
if (dsq->cameraPos.x - vw2 < (cameraMin.x+1)) if (dsq->cameraPos.x - vw2 < (cameraMin.x+1))
{ {
@ -9940,9 +9940,11 @@ void Game::constrainCamera()
cameraOffBounds = 1; cameraOffBounds = 1;
} }
int scrw, scrh; // The camera is positioned at (0, 0) screen coordinates, which, on widescreen resolutions,
scrw = core->getVirtualWidth()*core->invGlobalScale; // is *not* the upper left corner. Subtract the offset to get the real position.
scrh = 600*core->invGlobalScale; // HACK: One column shows through after blackness ends, adding TILE_SIZE fixes this. -- fg
float scrw = (core->getVirtualWidth()-core->getVirtualOffX()+TILE_SIZE)*core->invGlobalScale;
float scrh = 600*core->invGlobalScale;
if (cameraMax.x != -1 && dsq->cameraPos.x + scrw >= cameraMax.x) if (cameraMax.x != -1 && dsq->cameraPos.x + scrw >= cameraMax.x)
{ {