aboutsummaryrefslogtreecommitdiffstats
path: root/src/base/UMain.pas
diff options
context:
space:
mode:
authork-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2016-01-01 23:13:16 +0000
committerk-m_schindler <k-m_schindler@b956fd51-792f-4845-bead-9b4dfca2ff2c>2016-01-01 23:13:16 +0000
commit9156ce62f34de5c80d5103d874e20f231f22a054 (patch)
tree724336b982c7eded547a61f1905e5c2a51eb024b /src/base/UMain.pas
parentb0cfae07aef875c49684c189c484bb698352d1be (diff)
downloadusdx-9156ce62f34de5c80d5103d874e20f231f22a054.tar.gz
usdx-9156ce62f34de5c80d5103d874e20f231f22a054.tar.xz
usdx-9156ce62f34de5c80d5103d874e20f231f22a054.zip
add checkmousebutton
git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@3163 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'src/base/UMain.pas')
-rw-r--r--src/base/UMain.pas32
1 files changed, 20 insertions, 12 deletions
diff --git a/src/base/UMain.pas b/src/base/UMain.pas
index f0dc3d4e..416e0a50 100644
--- a/src/base/UMain.pas
+++ b/src/base/UMain.pas
@@ -37,6 +37,11 @@ uses
SysUtils,
SDL;
+var
+ CheckMouseButton: boolean; // for checking mouse motion
+ MAX_FPS: byte; // 0 to 255 is enough
+
+
procedure Main;
procedure MainLoop;
procedure CheckEvents;
@@ -106,6 +111,14 @@ begin
WindowTitle := USDXVersionStr;
Platform.Init;
+
+ // Commandline Parameter Parser
+ Params := TCMDParams.Create;
+
+ // Log + Benchmark
+ Log := TLog.Create;
+ Log.Title := WindowTitle;
+ //Log.FileOutputEnabled := not Params.NoLog;
if Platform.TerminateIfAlreadyRunning(WindowTitle) then
Exit;
@@ -136,14 +149,6 @@ begin
USTime := TTime.Create;
VideoBGTimer := TRelativeTimer.Create;
- // Commandline Parameter Parser
- Params := TCMDParams.Create;
-
- // Log + Benchmark
- Log := TLog.Create;
- Log.Title := WindowTitle;
- Log.FileOutputEnabled := not Params.NoLog;
-
// Language
Log.LogStatus('Initialize Paths', 'Initialization');
InitializePaths;
@@ -301,7 +306,7 @@ begin
CountSkipTime(); // JB - for some reason this seems to be needed when we use the SDL Timer functions.
repeat
TicksBeforeFrame := SDL_GetTicks;
-
+
// joypad
if (Ini.Joypad = 1) or (Params.Joypad) then
Joy.Update;
@@ -365,14 +370,17 @@ begin
case Event.type_ of
SDL_MOUSEMOTION:
begin
- mouseDown := false;
+ if (CheckMouseButton) then
+ mouseDown := true
+ else
+ mouseDown := false;
mouseBtn := 0;
end;
SDL_MOUSEBUTTONDOWN:
begin
mouseDown := true;
mouseBtn := Event.button.button;
-
+ CheckMouseButton := true;
if (mouseBtn = SDL_BUTTON_LEFT) or (mouseBtn = SDL_BUTTON_RIGHT) then
Display.OnMouseButton(true);
end;
@@ -380,7 +388,7 @@ begin
begin
mouseDown := false;
mouseBtn := Event.button.button;
-
+ CheckMouseButton := false;
if (mouseBtn = SDL_BUTTON_LEFT) or (mouseBtn = SDL_BUTTON_RIGHT) then
Display.OnMouseButton(false);
end;