SDL_VideoDriverName function
SDL_VideoDriverName -- Obtain the name of the video driver
Syntax
char* SDL_VideoDriverName(char* namebuf, int maxlen);
Description
The buffer pointed to by namebuf is filled up to a maximum of maxlen characters (including the NULL character) with the name of the initialized video driver. The driver name is a simple one word identifier like "x11", "windib" or "directx".
Note : Some platforms allow selection of the video driver through the SDL_VIDEODRIVER environment variable.
Parameters
namebuf [in]
- The pointer to the character buffer which is previously allocated by the caller
maxlen [in]
The maximum characters to fill in the character buffer namebuf
Return value
NULL
On error. The function returns NULL if the video has not been initialized with SDL_Init.
namebuf
On success. The function returns the value of namebuf
See also
Example
1 #include <iostream>
2 #include "SDL.h"
3
4 #define BUFFER_SIZE 256
5 char myBuffer[BUFFER_SIZE];
6
7 // Initialize SDL and the video subsystem
8 SDL_Init(SDL_INIT_VIDEO);
9
10 // Set the video mode
11 SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF|SDL_FULLSCREEN);
12
13 // Obtain the video driver name
14 if (SDL_VideoDriverName(myBuffer, BUFFER_SIZE) != NULL) {
15 std::cout << "The video driver name is " << myBuffer << std::endl;
16 }
17 else {
18 std::cerr << "Failed to obtain the video driver name." << std::endl;
19 }
20
21 // Shut down the SDL and all its subsystems
22 SDL_Quit();
Requirements
Header |
SDL.h |
Version |
1.2.13 |
Shared object |
libSDL.so |
DLL |
SDL.dll |
