File: window-resizing.patch

package info (click to toggle)
parsec47 0.2.dfsg1-11
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 6,352 kB
  • sloc: xml: 2,178; ansic: 47; makefile: 28
file content (34 lines) | stat: -rw-r--r-- 999 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# Copyright (C) 2007  Peter De Wachter <pdewacht@gmail.com>
# Distributed under the same license as the game. See debian/copyright.

--- a/src/abagames/util/sdl/Screen3D.d
+++ b/src/abagames/util/sdl/Screen3D.d
@@ -28,6 +28,8 @@
 
  private:
 
+  static Uint32 videoFlags;
+
   protected abstract void init();
   protected abstract void close();
 
@@ -42,7 +44,6 @@
 	"Unable to initialize SDL: " ~ std.string.toString(SDL_GetError()));
     }
     // Create an OpenGL screen.
-    Uint32 videoFlags;
     if (windowMode) {
       videoFlags = SDL_OPENGL | SDL_RESIZABLE;
     } else {
@@ -61,6 +62,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();