SDL_GetCurrentDisplayMode
Name
SDL_GetCurrentDisplayMode -- Get the current display mode.
Synopsis
#include "SDL_video.h" int SDL_GetCurrentDisplayMode (SDL_DisplayMode * mode);
Description
SDL_GetCurrentDisplayMode fills in information about the current display mode.
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_GetDesktopDisplayMode, SDL_GetNumDisplayModes, SDL_GetDisplayMode
