SDL Forum Index
SDL
Simple DirectMedia Layer Forums
Reply to topic
SDL_SetVideoMode creates a window of the wrong size (osx)
PeterP_op


Joined: 15 Apr 2010
Posts: 2
Location: Gothenburg
Reply with quote
Hello,

On startup in my program I call:

SDL_Surface *myScreen = SDL_SetVideoMode(480, 800, 16, SDL_SWSURFACE | SDL_RESIZABLE);

This works well on my development machine where I have a large screen and resolution.

But when this code runs on a MacBook with a native screen resolution of 1280x800, it automatically squeeze the window size to be much smaller (depending on the dock size etc).

However it doesn't tell me about this, so I end up misinterpreting where mouse clicks happens.

Is there a way to check what size the window actually ended up being, or even better: make if fail or report max size possible?
(myScreen->w=480, myScreen->h=800, which obviously doesn't match the actual window size in this case).

I haven't managed to setup SDL so I can step through SDL_SetVideoMode to check what actually happens, but I browsed through the bug database and it seems like it could be related to http://bugzilla.libsdl.org/show_bug.cgi?id=422, but I'm not sure.

Any help would be greatly appreciated.

Thanks,
Peter
View user's profileSend private message
SDL_SetVideoMode creates a window of the wrong size (osx)
Patrice Mandin
Guest

Reply with quote
Le Fri, 16 Apr 2010 04:05:39 -0700
"PeterP_op" a écrit:

Quote:
SDL_Surface *myScreen = SDL_SetVideoMode(480, 800, 16, SDL_SWSURFACE | SDL_RESIZABLE);

[snip]

Quote:
Is there a way to check what size the window actually ended up being,
or even better: make if fail or report max size possible?
(myScreen->w=480, myScreen->h=800, which obviously doesn't match the
actual window size in this case).

if myScreen->w and myScreen->h that are returned do not match what you
see on screen, maybe it's because you received a resize event you did
not take into account?

--
Patrice Mandin
WWW: http://pmandin.atari.org/
Programmeur Linux, Atari
Spécialité: Développement, jeux



_______________________________________________
SDL mailing list

http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
Re: SDL_SetVideoMode creates a window of the wrong size (osx
PeterP_op


Joined: 15 Apr 2010
Posts: 2
Location: Gothenburg
Reply with quote
Patrice Mandin wrote:
Le Fri, 16 Apr 2010 04:05:39 -0700
if myScreen->w and myScreen->h that are returned do not match what you
see on screen, maybe it's because you received a resize event you did
not take into account?


I check for SDL_VIDEORESIZE in my message handler, but I don't get any message. I get this message if I grab the bottom-right corner and resize the window after.

The SDL surface is still the original size, and it seems like Quartz or something in the OS layer is resizing the window to fit on screen and the SDL surface is stretched/squeezed to the window size.

So problem is that my mouse clicks aren't matching the visual position and the drawn 2d graphics looks squished since it's drawn with the wrong aspect ratio.
View user's profileSend private message
SDL_SetVideoMode creates a window of the wrong size (osx)
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 1 of 1  

  
  
 Reply to topic