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]

maxlen [in]

Return value

NULL

namebuf

See also

SDL_Init, SDL_InitSubSystem

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


CategorySDLVideo

SDL_VideoDriverName (last edited 2008-08-18 11:04:09 by NeoNeurone)