SDL_GetVideoInfo function
SDL_GetVideoInfo -- Returns a pointer to information about the current video hardware.
Syntax
const SDL_VideoInfo* SDL_GetVideoInfo(void);
Description
This function returns a read-only pointer to a structure containing information about the video hardware. If it is called before SDL_SetVideoMode, the vfmt member of the returned structure will contain the pixel format of the best video mode.
Parameter
nothing
Return value
Returns a read-only pointer to the structure containing the information about the current video hardware. Technically, it's a constant SDL_VideoInfo pointer.
See also
SDL_SetVideoMode, SDL_VideoInfo
Example
1 #include <iostream>
2 #include "SDL.h"
3
4 // Initialize SDL and the video subsystem
5 SDL_Init(SDL_INIT_VIDEO);
6
7 // Set the video mode
8 SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF|SDL_FULLSCREEN);
9
10 // Get the current video hardware information
11 const SDL_VideoInfo* myPointer = SDL_GetVideoInfo();
12
13 // Print out some information
14 // WARNING: myPointer is not NULL here
15 std::cout << "Current video resolution is " << myPointer->current_w << "x" << myPointer->current_h << " pixels" << std::endl;
Requirements
Header |
SDL.h |
Version |
1.2.13 |
Shared object |
libSDL.so |
DLL |
SDL.dll |
