From 0d66d9b6b30777f3e2e99e5d7dbddb6a0c904c35 Mon Sep 17 00:00:00 2001 From: tobigun Date: Sun, 2 May 2010 07:13:49 +0000 Subject: - Fix for "Wrong mouse position after screen-resize" bug reported here (http://forum.ultra-star.de/viewtopic.php?f=65&t=7768&p=57151#p57151) - Note: Screen.w and Screen.h are not updated after a resize as SDL_SetVideoMode is not called on windows on a resize event. Previously SDL_SetVideoMode invalidated all OpenGL textures resulting in most textures white. Using SDL_SetVideoMode at a resize seems to work now at least with SDL 1.2.14 and Win7. Maybe we should switch it on again. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2328 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/base/UMain.pas | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/base/UMain.pas') diff --git a/src/base/UMain.pas b/src/base/UMain.pas index ca14525f..53518d1e 100644 --- a/src/base/UMain.pas +++ b/src/base/UMain.pas @@ -426,8 +426,8 @@ begin end; end; - Display.MoveCursor(Event.button.X * 800 * Screens / Screen.w, - Event.button.Y * 600 / Screen.h); + Display.MoveCursor(Event.button.X * 800 * Screens / ScreenW, + Event.button.Y * 600 / ScreenH); if not Assigned(Display.NextScreen) then begin //drop input when changing screens @@ -456,6 +456,12 @@ begin // This would create a new OpenGL render-context and all texture data // would be invalidated. // On Linux the mode MUST be reset, otherwise graphics will be corrupted. + // Update: It seems to work now without creating a new OpenGL context. At least + // with Win7 and SDL 1.2.14. Maybe it generally works now with SDL 1.2.14 and we + // can switch it on for windows. + // Important: Unless SDL_SetVideoMode() is called (it is not on Windows), Screen.w + // and Screen.h are not valid after a resize and still contain the old size. Use + // ScreenW and ScreenH instead. {$IF Defined(Linux) or Defined(FreeBSD)} if boolean( Ini.FullScreen ) then SDL_SetVideoMode(ScreenW, ScreenH, (Ini.Depth+1) * 16, SDL_OPENGL or SDL_FULLSCREEN) -- cgit v1.2.3