src/render/SDL_render.c
changeset 6258 fce7ce72677b
parent 6247 b6212690f78d
child 6260 fd494c5f305b
--- a/src/render/SDL_render.c	Sun Jan 22 18:37:46 2012 -0500
+++ b/src/render/SDL_render.c	Sun Jan 22 19:22:53 2012 -0500
@@ -126,6 +126,26 @@
     return 0;
 }
 
+int
+SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags,
+                            SDL_Window **window, SDL_Renderer **renderer)
+{
+    *window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED,
+                                     SDL_WINDOWPOS_UNDEFINED,
+                                     width, height, window_flags);
+    if (!*window) {
+        *renderer = NULL;
+        return -1;
+    }
+
+    *renderer = SDL_CreateRenderer(*window, -1, 0);
+    if (!*renderer) {
+        return -1;
+    }
+
+    return 0;
+}
+
 SDL_Renderer *
 SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
 {