Resolution

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
john
Prole
Posts: 4
Joined: Mon Oct 10, 2011 11:26 am

Resolution

Post by john »

I'll star off by saying I'm a complete idiot so bear with me.

Is it possible with love to make a game where the resolution is scalable? For example all the demos that I see are always at a fixed resolution (you can go full screen but of course it just stretches it) i've never seen one where the game/demo has a resolution option.

as far as i can learn all I can do is give a position relative to the origin point 0,0 and do whatever i want there for lets a button and then put in the button pressed events. so if I had a window at 500x500 if I set something out 250 pixels it would be half way. but if I made the windows 1920x1080 it would be way off from being in the middle. so all I can think of right now to do is make the window the same aspect ratio i want but keep the res small so it will on a varyed type of monitors without just running off the screen if the monitor is too small in resolution. ie make the window 640x360 so it will fit on a pos monitor thats 640x480 as well as being scable up 960x540, 1024x576, 1280,720, 1366x768, 1600x900 etc etc. because the game would be much more beautiful that way on many different types of monitors rather than forcing some 1995 era resolution.

so im not sure how to progess. if you guys could point me in the right direction id be very grateful :3
User avatar
Ellohir
Party member
Posts: 235
Joined: Sat Oct 22, 2011 11:12 pm

Re: Resolution

Post by Ellohir »

I have used the camera from http://nova-fusion.com/2011/05/09/camer ... nt-bounds/ as I found it simple and easy to use at the same time. If you don't need a complete camera, the code you can use is:

Code: Select all

function love.draw()
  love.graphics.push()
  love.graphics.scale(scaleX, scaleY)
-- draw stuff here
  love.graphics.pop()
end
This will scale everything drawn by scaleX and scaleY, so the positions to be calculed are the same no matter the size. Combined with love.graphics.setMode you should be able to make some resolutions. Hope it helps! :)
john
Prole
Posts: 4
Joined: Mon Oct 10, 2011 11:26 am

Re: Resolution

Post by john »

this seems adequate

thanks :3
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Resolution

Post by Taehl »

I made the TLfres library just for this.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
john
Prole
Posts: 4
Joined: Mon Oct 10, 2011 11:26 am

Re: Resolution

Post by john »

Taehl wrote:I made the TLfres library just for this.
even better, thanks
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests