parsec47 (0.2.dfsg1-3) window-resizing.patch

Summary

 src/abagames/util/sdl/Screen3D.d |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

    
download this patch

Patch contents

# Copyright (C) 2007  Peter De Wachter <pdewacht@gmail.com>
# Distributed under the same license as the game. See debian/copyright.

Index: parsec47-0.2.dfsg1/src/abagames/util/sdl/Screen3D.d
===================================================================
--- parsec47-0.2.dfsg1.orig/src/abagames/util/sdl/Screen3D.d	2007-09-02 20:28:42.000000000 +0200
+++ parsec47-0.2.dfsg1/src/abagames/util/sdl/Screen3D.d	2007-09-02 20:29:40.000000000 +0200
@@ -51,6 +51,8 @@
 
  private:
 
+  static Uint32 videoFlags;
+
   protected abstract void init();
   protected abstract void close();
 
@@ -65,7 +67,6 @@
 	"Unable to initialize SDL: " ~ std.string.toString(SDL_GetError()));
     }
     // Create an OpenGL screen.
-    Uint32 videoFlags;
     if (windowMode) {
       videoFlags = SDL_OPENGL | SDL_RESIZABLE;
     } else {
@@ -84,6 +85,11 @@
   // Reset viewport when the screen is resized.
 
   private void screenResized() {
+    if (SDL_SetVideoMode(width, height, 0, videoFlags) == null) {
+      throw new Exception
+        ("Unable to resize SDL screen: " ~ std.string.toString(SDL_GetError()));
+    }
+
     glViewport(0, 0, width, height);
     glMatrixMode(GL_PROJECTION);
     glLoadIdentity();