From 8a5aebdd230d32c453292f480be693b08028e619 Mon Sep 17 00:00:00 2001 From: whiteshark0 Date: Mon, 25 Jan 2010 20:50:39 +0000 Subject: fix software cursor w/ screens = 2 git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@2096 b956fd51-792f-4845-bead-9b4dfca2ff2c --- src/menu/UDisplay.pas | 22 +++++++++++++--------- src/menu/UMenu.pas | 12 +++++++----- 2 files changed, 20 insertions(+), 14 deletions(-) (limited to 'src/menu') diff --git a/src/menu/UDisplay.pas b/src/menu/UDisplay.pas index f8f9c43f..fe29e438 100644 --- a/src/menu/UDisplay.pas +++ b/src/menu/UDisplay.pas @@ -377,11 +377,11 @@ begin // Draw OSD only on first Screen if Debug Mode is enabled if ((Ini.Debug = 1) or (Params.Debug)) and (S = 1) then - DrawDebugInformation; - end; // for + DrawDebugInformation; - if not BlackScreen then - DrawCursor; + if not BlackScreen then + DrawCursor; + end; // for end; { sets SDL_ShowCursor depending on options set in Ini } @@ -481,8 +481,9 @@ procedure TDisplay.DrawCursor; var Alpha: single; Ticks: cardinal; + DrawX: double; begin - if (Ini.Mouse = 2) then + if (Ini.Mouse = 2) and ((Screens = 1) or ((ScreenAct - 1) = (Round(Cursor_X+16) div 800))) then begin // draw software cursor Ticks := SDL_GetTicks; @@ -523,6 +524,9 @@ begin if (Alpha > 0) and (not Cursor_HiddenByScreen) then begin + DrawX := Cursor_X; + if (ScreenAct = 2) then + DrawX := DrawX - RenderW; glColor4f(1, 1, 1, Alpha); glEnable(GL_TEXTURE_2D); glEnable(GL_BLEND); @@ -535,16 +539,16 @@ begin glBegin(GL_QUADS); glTexCoord2f(0, 0); - glVertex2f(Cursor_X, Cursor_Y); + glVertex2f(DrawX, Cursor_Y); glTexCoord2f(0, 1); - glVertex2f(Cursor_X, Cursor_Y + 32); + glVertex2f(DrawX, Cursor_Y + 32); glTexCoord2f(1, 1); - glVertex2f(Cursor_X + 32, Cursor_Y + 32); + glVertex2f(DrawX + 32, Cursor_Y + 32); glTexCoord2f(1, 0); - glVertex2f(Cursor_X + 32, Cursor_Y); + glVertex2f(DrawX + 32, Cursor_Y); glEnd; glDisable(GL_BLEND); diff --git a/src/menu/UMenu.pas b/src/menu/UMenu.pas index 3ac487de..b928a612 100644 --- a/src/menu/UMenu.pas +++ b/src/menu/UMenu.pas @@ -1642,6 +1642,12 @@ begin Result:=ParseInput(SDLK_ESCAPE, 0, true); end; + // transfer mousecords to the 800x600 raster we use to draw + X := Round((X / (Screen.w / Screens)) * RenderW); + if (X > RenderW) then + X := X - RenderW; + Y := Round((Y / Screen.h) * RenderH); + nBut := InteractAt(X, Y); if nBut >= 0 then begin @@ -1657,7 +1663,7 @@ begin begin //click button or SelectS if (Interactions[nBut].Typ = iSelectS) then - Action := SelectsS[Interactions[nBut].Num].OnClick((X / Screen.w) * RenderW, (Y / Screen.h) * RenderH) + Action := SelectsS[Interactions[nBut].Num].OnClick(X, Y) else Action := maReturn; end @@ -1696,10 +1702,6 @@ end; function TMenu.InRegion(X, Y: real; A: TMouseOverRect): boolean; begin - // transfer mousecords to the 800x600 raster we use to draw - X := (X / Screen.w) * RenderW; - Y := (Y / Screen.h) * RenderH; - // check whether A contains X and Y Result := (X >= A.X) and (X <= A.X + A.W) and (Y >= A.Y) and (Y <= A.Y + A.H); end; -- cgit v1.2.3