Strange limit to mouse.getX-getY

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.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Strange limit to mouse.getX-getY

Post by vrld »

What if you set the window size in love.conf?
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
gerard
Prole
Posts: 5
Joined: Mon Jan 31, 2011 1:08 pm

Re: Strange limit to mouse.getX-getY

Post by gerard »

vrld wrote:What if you set the window size in love.conf?

That worked. I cannot use love.graphics.setMode, because the problem appears again, but at least I can start the game in the resolution I want.

Thanks. :ultraglee:
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Strange limit to mouse.getX-getY

Post by miko »

gerard wrote:As it seems to be a problem with my installation of love, I will try to reinstall it to see if that eliminates the problem.
Its not, I can confirm this with my setup (linux/love 0.7.0).
love always sets the 800x600 mode first, and then changes it with another setMode:

Code: Select all

$ ltrace  love . 2>&1 |grep VideoMode
SDL_VideoModeOK(800, 600, 32, 2, 0xb76d41c0)     = 32
SDL_SetVideoMode(800, 600, 32, 2, 0xbfbe12c0)    = 0x8e839d0
SDL_SetVideoMode(1280, 720, 32, 2, 0xb76db8a0)   = 0x8e839d0
BTW, the problem goes away if you set fullscreen mode to true.

Now that I tried it a few more times, the original code also works OK (with fullscreen=false). So it looks like the underlying SDL problem. Is it possible that calling SDL_SetVideoMode more than once is not defined for SDL?

SDL docs says:

Code: Select all

SDL_RESIZABLE
Create a resizable window. When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL_SetVideoMode can be called again with the new size.
So I guess that you need to pass SDL_RESIZABLE in the first call if you want to resize the window later with another SetVideoMode. Or love should generate SDL_VIDEORESIZE event after each resize (setMode with different W/H values). Or, if changing resolution on-the-fly is not supported within love (which should be documented), it should call SDL_SetVideoMode only once (doing "lazy initialization" after love.load() ).
Check this out: http://www.libsdl.org/docs/html/sdlresizeevent.html
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Strange limit to mouse.getX-getY

Post by bartbes »

The creation of two windows is simply because it is told to do so, if you want to set the resolution of the first window it creates use the config file.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Strange limit to mouse.getX-getY

Post by vrld »

miko wrote:So I guess that you need to pass SDL_RESIZABLE in the first call if you want to resize the window later with another SetVideoMode.
Resizable simply means that the user is able to change the window size. If that happens, the SDL_ResizeEvent tells how big the new window is, so you can draw accordingly.
SDL_SetVideoMode is for when you - the programmer - want to change the window size.

Anyway, this bug is (hopefully) fixed in the next release.
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
Post Reply

Who is online

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