diff src/video/SDL_video.c @ 1963:2590b68531ef

Added SDL_GetCurrentVideoDisplay()
author Sam Lantinga <slouken@libsdl.org>
date Wed, 02 Aug 2006 03:20:52 +0000
parents ba0d62354872
children a788656ca29a
line wrap: on
line diff
--- a/src/video/SDL_video.c	Sun Jul 30 08:09:20 2006 +0000
+++ b/src/video/SDL_video.c	Wed Aug 02 03:20:52 2006 +0000
@@ -355,13 +355,21 @@
         SDL_UninitializedVideo();
         return (-1);
     }
-    if (index >= 0) {
-        if (index >= _this->num_displays) {
-            SDL_SetError("index must be in the range 0 - %d",
-                         _this->num_displays - 1);
-            return -1;
-        }
-        _this->current_display = index;
+    if (index < 0 || index >= _this->num_displays) {
+        SDL_SetError("index must be in the range 0 - %d",
+                     _this->num_displays - 1);
+        return -1;
+    }
+    _this->current_display = index;
+    return 0;
+}
+
+int
+SDL_GetCurrentVideoDisplay(void)
+{
+    if (!_this) {
+        SDL_UninitializedVideo();
+        return (-1);
     }
     return _this->current_display;
 }