Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

#ActualGaiiden

Posted 29 December 2011 - 09:05 AM

Hi all,

Is there a way in SDL to get the "live" desktop size?  I'm able to receive the desktop area correctly, but what I want to do is force my game to fullscreen if too much of it is behind the dock on a Mac.

Since the screen is 800 pixels high, my game (at 768 pixels) reports that everything is okay-- but the bottom of the game (where I have some user interface) is behind the dock and can't be touched.  Meanwhile, the game window can't be dragged any higher on the screen.

So in general, I want to just say "the screen's too small to access the bottom of a 768 pixel window because of the size of the dock-- go fullscreen."  Any way to do that?

Thanks!


For SDL 1.2;
const SDL_VideoInfo* vInfo = SDL_GetVideoInfo();
int width = vInfo->current_w;
int height = vInfo->current_h;


For SDL 1.3

int displayIndex = SDL_GetWindowDisplay(window);
SDL_DisplayMode *displayMode;

SDL_GetDesktopDisplayMode(displayIndex,displayMode);

//width and height of the desktop is now stored as displayMode->w and displayMode->h
//(The displayIndex is set to the display that the center of the Window is located on)

Oh, and the SDL 1.2 code has to run before you call SDL_SetVideoMode to create the SDL Window otherwise it will give you the Windows properties rather than the desktops.

#4swiftcoder

Posted 29 December 2011 - 09:05 AM

Hi all,

Is there a way in SDL to get the "live" desktop size?  I'm able to receive the desktop area correctly, but what I want to do is force my game to fullscreen if too much of it is behind the dock on a Mac.

Since the screen is 800 pixels high, my game (at 768 pixels) reports that everything is okay-- but the bottom of the game (where I have some user interface) is behind the dock and can't be touched.  Meanwhile, the game window can't be dragged any higher on the screen.

So in general, I want to just say "the screen's too small to access the bottom of a 768 pixel window because of the size of the dock-- go fullscreen."  Any way to do that?

Thanks!


For SDL 1.2;
const SDL_VideoInfo* vInfo = SDL_GetVideoInfo();
int width = vInfo->current_w;
int height = vInfo->current_h;


For SDL 1.3

int displayIndex = SDL_GetWindowDisplay(window);
SDL_DisplayMode *displayMode;

SDL_GetDesktopDisplayMode(displayIndex,displayMode);

//width and height of the desktop is now stored as displayMode->w and displayMode->h
//(The displayIndex is set to the display that the center of the Window is located on)

#3Gaiiden

Posted 29 December 2011 - 09:05 AM

Hi all,

Is there a way in SDL to get the "live" desktop size?  I'm able to receive the desktop area correctly, but what I want to do is force my game to fullscreen if too much of it is behind the dock on a Mac.

Since the screen is 800 pixels high, my game (at 768 pixels) reports that everything is okay-- but the bottom of the game (where I have some user interface) is behind the dock and can't be touched.  Meanwhile, the game window can't be dragged any higher on the screen.

So in general, I want to just say "the screen's too small to access the bottom of a 768 pixel window because of the size of the dock-- go fullscreen."  Any way to do that?

Thanks!


For SDL 1.2;
const SDL_VideoInfo* vInfo = SDL_GetVideoInfo();
int width = vInfo->current_w;
int height = vInfo->current_h;


For SDL 1.3

int displayIndex = SDL_GetWindowDisplay(window);
SDL_DisplayMode *displayMode;

SDL_GetDesktopDisplayMode(displayIndex,displayMode);

//width and height of the desktop is now stored as displayMode->w and displayMode->h
//(The displayIndex is set to the display that the center of the Window is located on)

#2Gaiiden

Posted 29 December 2011 - 09:04 AM

Hi all,

Is there a way in SDL to get the "live" desktop size?  I'm able to receive the desktop area correctly, but what I want to do is force my game to fullscreen if too much of it is behind the dock on a Mac.

Since the screen is 800 pixels high, my game (at 768 pixels) reports that everything is okay-- but the bottom of the game (where I have some user interface) is behind the dock and can't be touched.  Meanwhile, the game window can't be dragged any higher on the screen.

So in general, I want to just say "the screen's too small to access the bottom of a 768 pixel window because of the size of the dock-- go fullscreen."  Any way to do that?

Thanks!


For SDL 1.2;
const SDL_VideoInfo* vInfo = SDL_GetVideoInfo();
int width = vInfo->current_w;
int height = vInfo->current_h;


For SDL 1.3

[font=arial,helvetica,sans-serif]int displayIndex = SDL_GetWindowDisplay(window)[font=monospace];[/font][/font]
[font=arial,helvetica,sans-serif][font=monospace]SDL_DisplayMode *displayMode;[/font][/font]

[font=arial,helvetica,sans-serif][font=monospace]SDL_GetDesktopDisplayMode(displayIndex,displayMode);[/font][/font]

[font=arial,helvetica,sans-serif][font=monospace]//width and height of the desktop is now stored as displayMode->w and displayMode->h[/font][/font]
//(The displayIndex is set to the display that the center of the Window is located on)

#1SimonForsman

Posted 29 December 2011 - 07:49 AM

Hi all,

Is there a way in SDL to get the "live" desktop size?  I'm able to receive the desktop area correctly, but what I want to do is force my game to fullscreen if too much of it is behind the dock on a Mac.

Since the screen is 800 pixels high, my game (at 768 pixels) reports that everything is okay-- but the bottom of the game (where I have some user interface) is behind the dock and can't be touched.  Meanwhile, the game window can't be dragged any higher on the screen.

So in general, I want to just say "the screen's too small to access the bottom of a 768 pixel window because of the size of the dock-- go fullscreen."  Any way to do that?

Thanks!


For SDL 1.2;
const SDL_VideoInfo* vInfo = SDL_GetVideoInfo();
int width = vInfo->current_w;
int height = vInfo->current_h;


For SDL 1.3


				
			

PARTNERS