r3925 - packages/trunk/titanion/debian/patches
Peter De Wachter
pdewacht-guest at alioth.debian.org
Tue Aug 28 21:28:44 UTC 2007
Author: pdewacht-guest
Date: 2007-08-28 21:28:44 +0000 (Tue, 28 Aug 2007)
New Revision: 3925
Added:
packages/trunk/titanion/debian/patches/window-resize.patch
Modified:
packages/trunk/titanion/debian/patches/series
Log:
Patch to fix window resizing.
Modified: packages/trunk/titanion/debian/patches/series
===================================================================
--- packages/trunk/titanion/debian/patches/series 2007-08-28 20:59:55 UTC (rev 3924)
+++ packages/trunk/titanion/debian/patches/series 2007-08-28 21:28:44 UTC (rev 3925)
@@ -2,3 +2,4 @@
directories.patch
windowed.patch
dotfile.patch
+window-resize.patch
Added: packages/trunk/titanion/debian/patches/window-resize.patch
===================================================================
--- packages/trunk/titanion/debian/patches/window-resize.patch (rev 0)
+++ packages/trunk/titanion/debian/patches/window-resize.patch 2007-08-28 21:28:44 UTC (rev 3925)
@@ -0,0 +1,63 @@
+Index: titanion_0.3.dfsg1/src/abagames/util/sdl/screen3d.d
+===================================================================
+--- titanion_0.3.dfsg1.orig/src/abagames/util/sdl/screen3d.d 2007-08-28 22:16:36.000000000 +0200
++++ titanion_0.3.dfsg1/src/abagames/util/sdl/screen3d.d 2007-08-28 23:02:14.000000000 +0200
+@@ -24,6 +24,7 @@
+ int _width = 640;
+ int _height = 480;
+ bool _windowMode = true;
++ Uint32 _videoFlags = 0;
+
+ protected abstract void init();
+ protected abstract void close();
+@@ -37,13 +38,12 @@
+ }
+ setIcon();
+ // 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()));
+ }
+@@ -56,7 +56,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: titanion_0.3.dfsg1/src/abagames/ttn/screen.d
+===================================================================
+--- titanion_0.3.dfsg1.orig/src/abagames/ttn/screen.d 2007-08-28 23:21:31.000000000 +0200
++++ titanion_0.3.dfsg1/src/abagames/ttn/screen.d 2007-08-28 23:22:06.000000000 +0200
+@@ -52,7 +52,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