diff options
author | basisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2015-08-23 03:15:31 +0000 |
---|---|---|
committer | basisbit <basisbit@b956fd51-792f-4845-bead-9b4dfca2ff2c> | 2015-08-23 03:15:31 +0000 |
commit | cb50c854d301fffedc760a24ff363c69c41e3ad8 (patch) | |
tree | 96fb650ba4d161ecdce253f8be8545c06342fad7 /src | |
parent | bd6edd76cbe2cdee409c050eee28292f0f1cbdb2 (diff) | |
download | usdx-cb50c854d301fffedc760a24ff363c69c41e3ad8.tar.gz usdx-cb50c854d301fffedc760a24ff363c69c41e3ad8.tar.xz usdx-cb50c854d301fffedc760a24ff363c69c41e3ad8.zip |
* limit to 60 FPS - be more energy friendly and laptop-friendly ;-)
* do not return any button-mouse-over-area when the mouse cursor is hidden - fixes certain access violations on windows
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3123 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r-- | src/base/UMain.pas | 2 | ||||
-rw-r--r-- | src/menu/UDisplay.pas | 3 | ||||
-rw-r--r-- | src/menu/UMenuButton.pas | 68 |
3 files changed, 39 insertions, 34 deletions
diff --git a/src/base/UMain.pas b/src/base/UMain.pas index 39f52c4d..6c2ab813 100644 --- a/src/base/UMain.pas +++ b/src/base/UMain.pas @@ -350,7 +350,7 @@ end; procedure MainLoop; const - MAX_FPS = 100; + MAX_FPS = 60; var Delay: integer; TicksCurrent: cardinal; diff --git a/src/menu/UDisplay.pas b/src/menu/UDisplay.pas index 6191fb68..9a196a74 100644 --- a/src/menu/UDisplay.pas +++ b/src/menu/UDisplay.pas @@ -72,7 +72,6 @@ type Cursor_X: double; Cursor_Y: double; Cursor_Pressed: boolean; - Cursor_HiddenByScreen: boolean; // hides software cursor and deactivate auto fade in // used for cursor fade out when there is no movement Cursor_Visible: boolean; @@ -84,6 +83,8 @@ type { called by MoveCursor and OnMouseButton to update last move and start fade in } procedure UpdateCursorFade; public + Cursor_HiddenByScreen: boolean; // hides software cursor and deactivate auto fade in, must be public for access in UMenuButton + NextScreen: PMenu; CurrentScreen: PMenu; diff --git a/src/menu/UMenuButton.pas b/src/menu/UMenuButton.pas index 868a86f3..509c140b 100644 --- a/src/menu/UMenuButton.pas +++ b/src/menu/UMenuButton.pas @@ -125,6 +125,7 @@ implementation uses SysUtils, + UDisplay, UDrawTexture; procedure TButton.SetX(Value: real); @@ -534,42 +535,45 @@ end; function TButton.GetMouseOverArea: TMouseOverRect; begin - if (FadeTex.TexNum = 0) then - begin - Result.X := Texture.X; - Result.Y := Texture.Y; - Result.W := Texture.W; - Result.H := Texture.H; - end - else + if (Display.Cursor_HiddenByScreen = false) then begin - case FadeTexPos of - 0: begin // fade tex on top - Result.X := Texture.X; - Result.Y := FadeTex.Y; - Result.W := Texture.W; - Result.H := FadeTex.H + Texture.H; - end; + if (FadeTex.TexNum = 0) then + begin + Result.X := Texture.X; + Result.Y := Texture.Y; + Result.W := Texture.W; + Result.H := Texture.H; + end + else + begin + case FadeTexPos of + 0: begin // fade tex on top + Result.X := Texture.X; + Result.Y := FadeTex.Y; + Result.W := Texture.W; + Result.H := FadeTex.H + Texture.H; + end; - 1: begin // fade tex on left side - Result.X := FadeTex.X; - Result.Y := Texture.Y; - Result.W := FadeTex.W + Texture.W; - Result.H := Texture.H; - end; + 1: begin // fade tex on left side + Result.X := FadeTex.X; + Result.Y := Texture.Y; + Result.W := FadeTex.W + Texture.W; + Result.H := Texture.H; + end; - 2: begin // fade tex on bottom - Result.X := Texture.X; - Result.Y := Texture.Y; - Result.W := Texture.W; - Result.H := FadeTex.H + Texture.H; - end; + 2: begin // fade tex on bottom + Result.X := Texture.X; + Result.Y := Texture.Y; + Result.W := Texture.W; + Result.H := FadeTex.H + Texture.H; + end; - 3: begin // fade tex on right side - Result.X := Texture.X; - Result.Y := Texture.Y; - Result.W := FadeTex.W + Texture.W; - Result.H := Texture.H; + 3: begin // fade tex on right side + Result.X := Texture.X; + Result.Y := Texture.Y; + Result.W := FadeTex.W + Texture.W; + Result.H := Texture.H; + end; end; end; end; |