Legal screen sizes?

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.
rmn_rmn
Prole
Posts: 21
Joined: Thu Jul 08, 2010 3:04 am

Legal screen sizes?

Post by rmn_rmn »

Hi everyone! I wonder what screen sizes are legal in LOVE? Thanks to useful replies I eventually managed fullscreen toggling, but now I get white screen when change screen size from the game. Here is the chunk typed in :mousepressed():

Code: Select all

...
      if n=="screensize_left" then
		   if self.mode>1 then
		     self.mode=self.mode-1
			 if self.mode==1 then love.graphics.setMode(1024,768,self.fullscreen_on,false,0)
			 elseif self.mode==2 then love.graphics.setMode(1280,1024,self.fullscreen_on,false,0)
			 elseif self.mode==3 then love.graphics.setMode(1440,900,self.fullscreen_on,false,0)
			 end
		   end
		end
		if n=="screensize_right" then
		    if self.mode<4 then
		     self.mode=self.mode+1
			 if self.mode==4 then love.graphics.setMode(1600,1200,self.fullscreen_on,false,0)
			 elseif self.mode==2 then love.graphics.setMode(1280,1024,self.fullscreen_on,false,0)
			 elseif self.mode==3 then love.graphics.setMode(1440,900,self.fullscreen_on,false,0)
			 end
		   end
		end
I also get messages (my initial size is 1440*900, fullscreen is on):
"Could not set video mode: No video mode large enough for 1280x1024" - on the left button
"Could not set video mode: No video mode large enough for 1600x1200" - on the right button
May be somebody already faced this behavior?
rmn_rmn
Prole
Posts: 21
Joined: Thu Jul 08, 2010 3:04 am

Re: Legal screen sizes?

Post by rmn_rmn »

Ok, I read the topic below about screen sizes, mine are legal. But why do I get this white screen and error messages?
User avatar
Felipe Budinich
Citizen
Posts: 67
Joined: Thu Jul 29, 2010 1:36 pm

Re: Legal screen sizes?

Post by Felipe Budinich »

rmn_rmn wrote:Ok, I read the topic below about screen sizes, mine are legal. But why do I get this white screen and error messages?
As far as I know, you could set any size, as long as the video card supports it, so you should check if your card supports the mode (before trying to set it, i mean).

PS: And then, check if your video card really does, because as far as I know, Dilbert is a documentary.
rmn_rmn
Prole
Posts: 21
Joined: Thu Jul 08, 2010 3:04 am

Re: Legal screen sizes?

Post by rmn_rmn »

As far as I know, you could set any size, as long as the video card supports it, so you should check if your card supports the mode (before trying to set it, i mean).
Thank you, I should have checked it before asking a question. Now, once more problem: how do I map my graphics onto current screen size? For instance, I develop my game under 1440*900 and use the coordinates so that my graphics fit it well, but when I switch to 1280*800, the proportion doesn't change, so I get my graphics shifted. On the contrary, when I developed under 1024*768 and then switched to 1440*900, proportions remained the same and the only bad thing was that I had ugly zoomed textures (you know, when you use a 1024*768 wallpaper on your wide monitor).
User avatar
Felipe Budinich
Citizen
Posts: 67
Joined: Thu Jul 29, 2010 1:36 pm

Re: Legal screen sizes?

Post by Felipe Budinich »

I think there are several ways to go about it (i haven't tried them all), but you've got to think in proportions. The simplest method would be to check if that the mode you want is actually the same aspect ratio as your windowed game. (this is very simple, just divide the width for the height, and if it is the same number, you are set, because pixels will be square)
rmn_rmn
Prole
Posts: 21
Joined: Thu Jul 08, 2010 3:04 am

Re: Legal screen sizes?

Post by rmn_rmn »

Felipe Budinich wrote:I think there are several ways to go about it (i haven't tried them all), but you've got to think in proportions. The simplest method would be to check if that the mode you want is actually the same aspect ratio as your windowed game. (this is very simple, just divide the width for the height, and if it is the same number, you are set, because pixels will be square)
Hmmm...Look, if I have an image 1000*800 which is sitiuated at the center of the screen under 1440*900, what should I do to put it at the center under 1024*768? Of course, I don't want to create 5 variants of every image for 5 resolutions (moreover, I'll have to change coordinates every time :ehem: ).
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Legal screen sizes?

Post by Robin »

Help us help you: attach a .love.
rmn_rmn
Prole
Posts: 21
Joined: Thu Jul 08, 2010 3:04 am

Re: Legal screen sizes?

Post by rmn_rmn »

Thanks Robin, it is very useful. I also think love.graphics.translate() may help with coordinates, but scaling...I found that switching to fullscreen from 1024*768 maps graphics well (in sense of proportions), but switching from 1440*900 to 1024*768 doesn't. May be I'm doing something wrong?
pekka
Party member
Posts: 206
Joined: Thu Jan 07, 2010 6:48 am
Location: Oulu, Finland
Contact:

Re: Legal screen sizes?

Post by pekka »

rmn_rmn wrote:
Thanks Robin, it is very useful. I also think love.graphics.translate() may help with coordinates, but scaling...I found that switching to fullscreen from 1024*768 maps graphics well (in sense of proportions), but switching from 1440*900 to 1024*768 doesn't. May be I'm doing something wrong?
Ideally, in all modes pixels should be square, which means they each should take up as much space horizontally and vertically. Löve's graphics functions are build on this assumption. For many computers and displays this is not true on all resolution, and what is worse, you cannot predict whether a particular resolution will work on every computer and look the same.

You can use love.graphics.scale() with different scaling factors to correct the proportions for a particular display setup, but in turn this correction will result in the proportions being wrong on another computer. I wrote a simple program to test this correction on my laptop at one time, and the program is still available on the board. Look here:

http://love2d.org/forums/viewtopic.php? ... 510#p14510

I must repeat the warning I put there. It is just for my computer, and it is not a robust solution that you can use with a game you intend to distribute. The only robust solution I can think of is allowing the user to correct the aspect ratio in the game setup screen, because the user knows what the game actually looks like on his display. It's a pain.

The simple solution is just to assume square pixels and allow the user to change the full-screen resolution from those that the getModes() function finds. In this case the user can simply avoid the resolutions that make the game look bad.

I don't use Vista, but I've heard it has options for controlling the aspect ratio of programs (games) you run full-screen with it. That's again something you annot control with Löve at all.
User avatar
Felipe Budinich
Citizen
Posts: 67
Joined: Thu Jul 29, 2010 1:36 pm

Re: Legal screen sizes?

Post by Felipe Budinich »

rmn_rmn wrote:Hmmm...Look, if I have an image 1000*800 which is sitiuated at the center of the screen under 1440*900, what should I do to put it at the center under 1024*768? Of course, I don't want to create 5 variants of every image for 5 resolutions (moreover, I'll have to change coordinates every time :ehem: ).
I would do: ("Ancho" means width in spanish. "Alto" means height. "Imagen" means Image)

Code: Select all

function love.load()
	imagen = love.graphics.newImage("image_file.png")
	ancho = (love.graphics.getWidth())/2 - (imagen:getWidth())/2
	alto = (love.graphics.getHeight())/2 - (imagen:getHeight())/2
end

function love.draw()
	love.graphics.draw(imagen, ancho, alto)
end
Of course, now, someone with better math skills will come an simplify that :death: . (I studied fine arts, so sue me)

Basically your image will be in the middle of the screen, no matter the resolution as long as your image size is divisible by 2, but if they are po2 you should be alright, unless your images are bigger than the screen... I haven't tried that, i'll go break my code now! cya

PS: It did not get broken, it just drew the image outside of the screen. kinda obvious now that i think about it. On an unrelated note, my math skills are broken, for some reason the images are centered to the horizontal resolution, but i can't wrap my mind around the vertical one.
Post Reply

Who is online

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