comparison src/video/SDL_video.c @ 1660:8b9d79e7eacf SDL-1.3

Added API requested in bug #43: Added SDL_GetNumVideoDrivers() and SDL_GetVideoDriver(). Replaced SDL_VideoDriverName() with SDL_GetCurrentVideoDriver() Added SDL_GetNumAudioDrivers() and SDL_GetAudioDriver(). Replaced SDL_AudioDriverName() with SDL_GetCurrentAudioDriver()
author Sam Lantinga <slouken@libsdl.org>
date Sat, 20 May 2006 04:35:58 +0000
parents e49147870aac
children 782fd950bd46
comparison
equal deleted inserted replaced
1659:14717b52abc0 1660:8b9d79e7eacf
135 int SDL_VideoInit(const char *driver_name, Uint32 flags); 135 int SDL_VideoInit(const char *driver_name, Uint32 flags);
136 void SDL_VideoQuit(void); 136 void SDL_VideoQuit(void);
137 137
138 static SDL_GrabMode SDL_WM_GrabInputOff(void); 138 static SDL_GrabMode SDL_WM_GrabInputOff(void);
139 139
140 int SDL_GetNumVideoDrivers(void)
141 {
142 return(SDL_arraysize(bootstrap)-1);
143 }
144
145 const char *SDL_GetVideoDriver(int index)
146 {
147 if ( index >= 0 && index < SDL_GetNumVideoDrivers() ) {
148 return(bootstrap[index]->name);
149 }
150 return(NULL);
151 }
140 152
141 /* 153 /*
142 * Initialize the video and event subsystems -- determine native pixel format 154 * Initialize the video and event subsystems -- determine native pixel format
143 */ 155 */
144 int SDL_VideoInit (const char *driver_name, Uint32 flags) 156 int SDL_VideoInit (const char *driver_name, Uint32 flags)
276 288
277 /* We're ready to go! */ 289 /* We're ready to go! */
278 return(0); 290 return(0);
279 } 291 }
280 292
281 char *SDL_VideoDriverName(char *namebuf, int maxlen) 293 const char *SDL_GetCurrentVideoDriver()
282 { 294 {
283 if ( current_video != NULL ) { 295 if ( current_video ) {
284 SDL_strlcpy(namebuf, current_video->name, maxlen); 296 return current_video->name;
285 return(namebuf);
286 } 297 }
287 return(NULL); 298 return(NULL);
288 } 299 }
289 300
290 /* 301 /*