LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File tumiki-fighters-window-resizing.patch of Package tumiki-fighters (Project home:ykoba)

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

Index: tf/src/abagames/util/sdl/screen3d.d
===================================================================
--- tf.orig/src/abagames/util/sdl/screen3d.d
+++ tf/src/abagames/util/sdl/screen3d.d
@@ -23,6 +23,7 @@ public class Screen3D: Screen {
   static bool windowMode = true;
   static float nearPlane = 0.1;
   static float farPlane = 1000;
+  static Uint32 videoFlags;
 
  private:
 
@@ -36,7 +37,6 @@ public class Screen3D: Screen {
 	"Unable to initialize SDL: " ~ std.string.toString(SDL_GetError()));
     }
     // Create an OpenGL screen.
-    Uint32 videoFlags;
     if (windowMode) {
       videoFlags = SDL_OPENGL | SDL_RESIZABLE;
     } else {
@@ -56,6 +56,10 @@ public class Screen3D: Screen {
   // Reset viewport when the screen is resized.
 
   public 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();