X-Git-Url: https://deadsoftware.ru/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fgame%2Fg_touch.pas;h=a35a56ef75fe8ce57750c0585153d04205d83387;hb=6c6b87eea9373ec4f1cb859223d3708d8e2a59c6;hp=0638cc2713bfbfb432e484160ff431faa77adcbf;hpb=31039aaf7e1623de1a4be292d0c77532fcfbf3e6;p=d2df-sdl.git diff --git a/src/game/g_touch.pas b/src/game/g_touch.pas index 0638cc2..a35a56e 100644 --- a/src/game/g_touch.pas +++ b/src/game/g_touch.pas @@ -2,8 +2,7 @@ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * the Free Software Foundation, version 3 of the License ONLY. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -37,7 +36,7 @@ implementation uses SysUtils, - e_log, e_graphics, e_input, g_options, g_game, g_main, g_weapons, g_console; + e_log, e_graphics, e_input, g_options, g_game, g_main, g_gui, g_weapons, g_console, g_window; var angleFire: Boolean; @@ -184,6 +183,7 @@ implementation procedure g_Touch_Init; begin {$IFNDEF HEADLESS} + g_Touch_ShowKeyboard(FALSE); g_touch_enabled := SDL_GetNumTouchDevices() > 0 {$ENDIF} end; @@ -191,10 +191,10 @@ implementation procedure g_Touch_ShowKeyboard(yes: Boolean); begin {$IFNDEF HEADLESS} - if not g_touch_enabled then - Exit; - - if yes then + if g_dbg_input then + e_LogWritefln('g_Touch_ShowKeyboard(%s)', [yes]); + (* on desktop we always receive text (needed for cheats) *) + if yes or (SDL_HasScreenKeyboardSupport() = SDL_FALSE) then SDL_StartTextInput else SDL_StopTextInput @@ -207,12 +207,15 @@ implementation procedure KeyUp (finger, i: Integer); begin + if g_dbg_input then + e_LogWritefln('Input Debug: g_touch.KeyUp, finger=%s, key=%s', [finger, i]); + keyFinger[i] := 0; e_KeyUpDown(i, False); g_Console_ProcessBind(i, False); (* up/down + fire hack *) - if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and angleFire then + if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and (g_ActiveWindow = nil) and angleFire then begin if (i = VK_UP) or (i = VK_DOWN) then begin @@ -226,13 +229,15 @@ implementation procedure KeyDown (finger, i: Integer); begin - KeyPress(i); // Menu events + if g_dbg_input then + e_LogWritefln('Input Debug: g_touch.KeyDown, finger=%s, key=%s', [finger, i]); + keyFinger[i] := finger; e_KeyUpDown(i, True); g_Console_ProcessBind(i, True); (* up/down + fire hack *) - if g_touch_fire and (gGameSettings.GameType <> GT_NONE) then + if g_touch_fire and (gGameSettings.GameType <> GT_NONE) and (g_ActiveWindow = nil) then begin if i = VK_UP then begin @@ -290,7 +295,9 @@ implementation end; procedure g_Touch_Draw; +{$IFNDEF HEADLESS} var i, x, y, w, h: Integer; founded: Boolean; +{$ENDIF} begin {$IFNDEF HEADLESS} if not g_touch_enabled then