[SOLVED] Scaling issues

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

[SOLVED] Scaling issues

Post by rmcode »

I have a problem with my latest game. Basically I wanted to scale it based on the screen's resolution. The scaling itself works fine, but now I wanted to put the ingame cameras back in. These cameras have the job to track the player's position and zoom while keeping the player at their center.

The problem is, that both systems work perfectly fine on their own. My screen scaler scales the screen correctly and the cameras track the player (keeping him in the center of the screen). But when I try to put them together everything breaks.

You can use the 'w' and 's' keys to zoom the camera in and out and it should keep the small green rectangle at its center. You can use 'e' and 'd' to scale the image and you will notice that the green rectangle doesn't stay in the center of the screen anymore. The scissor breaks too (the red circle should actually be cut off at the corner of the rectangle).

I tried my best to fix it, but it didn't work out.



EDIT: Posted in the wrong section. Already reported it.
Last edited by rmcode on Mon Oct 27, 2014 2:47 am, edited 1 time in total.
User avatar
Evine
Citizen
Posts: 72
Joined: Wed May 28, 2014 11:46 pm

Re: Scaling issues

Post by Evine »

Poked around a bit. :D I've figured it had something to do with the resolution change.
Line 21 in Camera.lua

Old

Code: Select all

love.graphics.translate(love.graphics.getWidth() / (2 * sx), love.graphics.getHeight() / (2 * sy));
New

Code: Select all

love.graphics.translate(320 / (2 * sx), 240 / (2 * sy));
Artal, A .PSD loader: https://github.com/EvineDev/Artal
User avatar
rmcode
Party member
Posts: 454
Joined: Tue Jul 15, 2014 12:04 pm
Location: Germany
Contact:

Re: [SOLVED] Scaling issues

Post by rmcode »

Thanks Evine! That solved the issue :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 190 guests