diff 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
line wrap: on
line diff
--- a/src/video/SDL_video.c	Wed May 17 08:18:28 2006 +0000
+++ b/src/video/SDL_video.c	Sat May 20 04:35:58 2006 +0000
@@ -137,6 +137,18 @@
 
 static SDL_GrabMode SDL_WM_GrabInputOff(void);
 
+int SDL_GetNumVideoDrivers(void)
+{
+	return(SDL_arraysize(bootstrap)-1);
+}
+
+const char *SDL_GetVideoDriver(int index)
+{
+	if ( index >= 0 && index < SDL_GetNumVideoDrivers() ) {
+		return(bootstrap[index]->name);
+	}
+	return(NULL);
+}
 
 /*
  * Initialize the video and event subsystems -- determine native pixel format
@@ -278,11 +290,10 @@
 	return(0);
 }
 
-char *SDL_VideoDriverName(char *namebuf, int maxlen)
+const char *SDL_GetCurrentVideoDriver()
 {
-	if ( current_video != NULL ) {
-		SDL_strlcpy(namebuf, current_video->name, maxlen);
-		return(namebuf);
+	if ( current_video ) {
+		return current_video->name;
 	}
 	return(NULL);
 }