DEADSOFTWARE

menu: optionally disable menu in client
[d2df-sdl.git] / src / game / sdl2 / g_touch.pas
index 23cfbc1fc3ca8920b518d9e0af0494ae7de90ab7..645176010962aafa8b105f8389d3116f3cf3660b 100644 (file)
@@ -35,8 +35,12 @@ interface
 implementation
 
   uses
+    {$IFDEF ENABLE_MENU}
+      g_gui,
+    {$ENDIF}
     SysUtils,
-    e_log, e_graphics, e_input, g_options, g_game, g_main, g_gui, g_weapons, g_console, g_window;
+    e_log, r_graphics, r_game, e_input, g_options, g_game, g_weapons, g_console
+  ;
 
   var
     angleFire: Boolean;
@@ -65,7 +69,7 @@ implementation
       dpi := 96;
     {$ENDIF}
 
-    sz := Trunc(g_touch_size * dpi); sw := gScreenWidth; sh := gScreenHeight;
+    sz := Trunc(g_touch_size * dpi); sw := gWinSizeX; sh := gWinSizeY;
     x := 0; y := Round(sh * g_touch_offset / 100);
     w := sz; h := sz;
 
@@ -219,7 +223,11 @@ implementation
       g_Console_ProcessBind(i, False);
 
       (* up/down + fire hack *)
+{$IFDEF ENABLE_MENU}
       if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and (g_ActiveWindow = nil) and angleFire then
+{$ELSE}
+      if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and angleFire then
+{$ENDIF}
       begin
         if (i = VK_UP) or (i = VK_DOWN) then
         begin
@@ -241,7 +249,11 @@ implementation
       g_Console_ProcessBind(i, True);
 
       (* up/down + fire hack *)
+{$IFDEF ENABLE_MENU}
       if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and (g_ActiveWindow = nil) then
+{$ELSE}
+      if g_touch_fire and (gGameSettings.GameType <> GT_NONE) then
+{$ENDIF}
       begin
         if i = VK_UP then
         begin
@@ -274,8 +286,8 @@ implementation
       Exit;
 
     finger := ev.fingerId + 2;
-    x := Trunc(ev.x * gScreenWidth);
-    y := Trunc(ev.y * gScreenHeight);
+    x := Trunc(ev.x * gWinSizeX);
+    y := Trunc(ev.y * gWinSizeY);
 
     for i := VK_FIRSTKEY to VK_LASTKEY do
     begin