SDL_GetDesktopDisplayMode

Name

SDL_GetDesktopDisplayMode -- Get the desktop display mode.

Synopsis

#include "SDL_video.h"

int SDL_GetDesktopDisplayMode (SDL_DisplayMode * mode);

Description

SDL_GetDesktopDisplayMode fills in information about the desktop display mode for the current display.

Return Value

Returns 0 if successful or -1 if the video subsystem has not been initialized.

Example

   1 #include "SDL.h"
   2 #include <stdio.h>
   3 
   4 int main(int argc, char** argv)  {
   5   SDL_DisplayMode mode;
   6   
   7   if (SDL_Init(SDL_INIT_VIDEO) != 0)  {
   8     printf ("Error initializing SDL:  %s\n", SDL_GetError());
   9     return 1;
  10   }
  11   atexit (SDL_Quit);
  12   
  13   SDL_GetDesktopDisplayMode(&mode);
  14   printf ("The desktop display mode is %d x %d, %d Hz, %d BPP\n",
  15           mode.w, mode.h, mode.refresh_rate, SDL_BITSPERPIXEL(mode.format));
  16   
  17   SDL_GetFullscreenDisplayMode(&mode);
  18   printf ("The fullscreen display mode is %d x %d, %d Hz, %d BPP\n",
  19           mode.w, mode.h, mode.refresh_rate, SDL_BITSPERPIXEL(mode.format));
  20   
  21   SDL_GetCurrentDisplayMode(&mode);
  22   printf ("The current display mode is %d x %d, %d Hz, %d BPP\n",
  23           mode.w, mode.h, mode.refresh_rate, SDL_BITSPERPIXEL(mode.format));
  24 }

See Also

SDL_GetFullscreenDisplayMode, SDL_GetCurrentDisplayMode, SDL_GetNumDisplayModes, SDL_GetDisplayMode


CategorySDL13API CategorySDL13APIVideo

SDL-1.3/SDL_GetDesktopDisplayMode (last edited 2009-07-30 03:40:15 by KenBull)