r3930 - packages/trunk/mu-cade/debian/patches
Peter De Wachter
pdewacht-guest at alioth.debian.org
Tue Aug 28 22:15:14 UTC 2007
Author: pdewacht-guest
Date: 2007-08-28 22:15:14 +0000 (Tue, 28 Aug 2007)
New Revision: 3930
Added:
packages/trunk/mu-cade/debian/patches/window-resize.patch
Modified:
packages/trunk/mu-cade/debian/patches/series
Log:
Patch to fix window resizing.
Modified: packages/trunk/mu-cade/debian/patches/series
===================================================================
--- packages/trunk/mu-cade/debian/patches/series 2007-08-28 21:59:51 UTC (rev 3929)
+++ packages/trunk/mu-cade/debian/patches/series 2007-08-28 22:15:14 UTC (rev 3930)
@@ -2,3 +2,4 @@
directories.patch
windowed.patch
dotfile.patch
+window-resize.patch
Added: packages/trunk/mu-cade/debian/patches/window-resize.patch
===================================================================
--- packages/trunk/mu-cade/debian/patches/window-resize.patch (rev 0)
+++ packages/trunk/mu-cade/debian/patches/window-resize.patch 2007-08-28 22:15:14 UTC (rev 3930)
@@ -0,0 +1,63 @@
+Index: mu-cade_0.11.dfsg1/src/abagames/util/sdl/screen3d.d
+===================================================================
+--- mu-cade_0.11.dfsg1.orig/src/abagames/util/sdl/screen3d.d 2007-08-29 00:07:03.000000000 +0200
++++ mu-cade_0.11.dfsg1/src/abagames/util/sdl/screen3d.d 2007-08-29 00:07:10.000000000 +0200
+@@ -23,6 +23,7 @@
+ int _width = 640;
+ int _height = 480;
+ bool _windowMode = true;
++ Uint32 _videoFlags = 0;
+
+ protected abstract void init();
+ protected abstract void close();
+@@ -34,13 +35,12 @@
+ "Unable to initialize SDL: " ~ std.string.toString(SDL_GetError()));
+ }
+ // Create an OpenGL screen.
+- Uint32 videoFlags;
+ if (_windowMode) {
+- videoFlags = SDL_OPENGL | SDL_RESIZABLE;
++ _videoFlags = SDL_OPENGL | SDL_RESIZABLE;
+ } else {
+- videoFlags = SDL_OPENGL | SDL_FULLSCREEN;
++ _videoFlags = SDL_OPENGL | SDL_FULLSCREEN;
+ }
+- if (SDL_SetVideoMode(_width, _height, 0, videoFlags) == null) {
++ if (SDL_SetVideoMode(_width, _height, 0, _videoFlags) == null) {
+ throw new SDLInitFailedException
+ ("Unable to create SDL screen: " ~ std.string.toString(SDL_GetError()));
+ }
+@@ -53,7 +53,20 @@
+
+ // Reset a viewport when the screen is resized.
+ public void screenResized() {
+- glViewport(0, 0, _width, _height);
++ int screen_width = _width;
++ int screen_height = _height;
++ if (SDL_SetVideoMode(screen_width, screen_height, 0, _videoFlags) == null) {
++ throw new SDLInitFailedException
++ ("Unable to resize SDL screen: " ~ std.string.toString(SDL_GetError()));
++ }
++
++ // adjust width and height to maintain correct aspect ratio
++ if (screen_width * 480 > screen_height * 640)
++ _width = screen_height * 640 / 480;
++ else if (screen_width * 480 < screen_height * 640)
++ _height = screen_width * 480 / 640;
++
++ glViewport((screen_width - _width) / 2, screen_height - _height, _width, _height);
+ glMatrixMode(GL_PROJECTION);
+ setPerspective();
+ glMatrixMode(GL_MODELVIEW);
+Index: mu-cade_0.11.dfsg1/src/abagames/mcd/screen.d
+===================================================================
+--- mu-cade_0.11.dfsg1.orig/src/abagames/mcd/screen.d 2006-02-19 05:57:26.000000000 +0100
++++ mu-cade_0.11.dfsg1/src/abagames/mcd/screen.d 2007-08-29 00:07:10.000000000 +0200
+@@ -62,7 +62,6 @@
+ else if (lw > 4)
+ lw = 4;
+ glLineWidth(lw);
+- glViewport(0, 0, width, height);
+ if (field)
+ field.setLookAt();
+ }
More information about the Pkg-games-commits
mailing list