summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 09aefa8)
raw | patch | inline | side by side (parent: 09aefa8)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 5 May 2018 22:28:29 +0000 (01:28 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sun, 6 May 2018 10:33:04 +0000 (13:33 +0300) |
src/game/g_language.pas | patch | blob | history | |
src/game/g_menu.pas | patch | blob | history | |
src/game/g_options.pas | patch | blob | history | |
src/game/g_touch.pas | patch | blob | history |
index 18d0d72750a361b145eb823c115007667d8d4f95..8cadba100245e60df8406e561fb307f11f4f188e 100644 (file)
--- a/src/game/g_language.pas
+++ b/src/game/g_language.pas
I_MENU_CONTROL_DEADZONE,
I_MENU_CONTROL_TOUCH,
+ I_MENU_CONTROL_TOUCH_ALT,
I_MENU_CONTROL_TOUCH_FIRE,
I_MENU_CONTROL_TOUCH_SIZE,
I_MENU_CONTROL_TOUCH_OFFSET,
('MENU CONTROL TOCUH', 'Touchscreen Settings',
'Íàñòðîéêè ñåíñðíîãî ýêðàíà'),
+ ('MENU CONTROL TOUCH ALT', 'Alternative layout:',
+ 'Àëüòåðíàòèâíàÿ ðàñêëàäêà:'),
('MENU CONTROL TOUCH FIRE', 'Shoot Up/Down:',
'Ñòðåëÿòü ââåðõ/âíèç:'),
('MENU CONTROL TOUCH SIZE', 'Button size:',
diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas
index 629c38c69adc30a0a8feccfefddf376c6f462480..b84467fcc9c5052b997dce6079aab4098c585898 100644 (file)
--- a/src/game/g_menu.pas
+++ b/src/game/g_menu.pas
end;
end;
- if SDL_GetNumTouchDevices() > 0 then
+ if g_touch_enabled then
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
+ g_touch_alt := TGUISwitch(menu.GetControl('swTouchAlt')).ItemIndex = 1;
g_touch_size := TGUIScroll(menu.GetControl('scTouchSize')).Value / 10 + 0.5;
g_touch_fire := TGUISwitch(menu.GetControl('swTouchFire')).ItemIndex = 1;
g_touch_offset := TGUIScroll(menu.GetControl('scTouchOffset')).Value * 5;
end;
end;
- if SDL_GetNumTouchDevices() > 0 then
+ if g_touch_enabled then
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
+ with TGUISwitch(menu.GetControl('swTouchAlt')) do
+ if g_touch_alt then ItemIndex := 1 else ItemIndex := 0;
TGUIScroll(menu.GetControl('scTouchSize')).Value := Round((g_touch_size - 0.5) * 10);
with TGUISwitch(menu.GetControl('swTouchFire')) do
if g_touch_fire then ItemIndex := 1 else ItemIndex := 0;
menu: TGUIMenu;
begin
menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsTouchMenu').GetControl('mOptionsControlsTouchMenu'));
+ g_touch_alt := TGUISwitch(menu.GetControl('swTouchAlt')).ItemIndex = 1;
g_touch_size := TGUIScroll(menu.GetControl('scTouchSize')).Value / 10 + 0.5;
g_touch_offset := TGUIScroll(menu.GetControl('scTouchOffset')).Value * 5;
end;
AddSpace();
AddButton(nil, _lc[I_MENU_CONTROL_JOYSTICKS], 'OptionsControlsJoystickMenu');
end;
- if SDL_GetNumTouchDevices() > 0 then
+ if g_touch_enabled then
begin
AddSpace();
AddButton(nil, _lc[I_MENU_CONTROL_TOUCH], 'OptionsControlsTouchMenu');
with TGUIMenu(Menu.AddChild(TGUIMenu.Create(gMenuFont, gMenuSmallFont, _lc[I_MENU_CONTROL_TOUCH]))) do
begin
Name := 'mOptionsControlsTouchMenu';
+ with AddSwitch(_lc[I_MENU_CONTROL_TOUCH_ALT]) do
+ begin
+ Name := 'swTouchAlt';
+ AddItem(_lc[I_MENU_NO]);
+ AddItem(_lc[I_MENU_YES]);
+ OnChange := ProcChangeTouchSettings;
+ end;
with AddScroll(_lc[I_MENU_CONTROL_TOUCH_SIZE]) do
begin
Name := 'scTouchSize';
diff --git a/src/game/g_options.pas b/src/game/g_options.pas
index 0397f37f65d2a75f2d1918779222cad5344e5857..15719e6f894fc0f5fce3886235b0e8df523cb339 100644 (file)
--- a/src/game/g_options.pas
+++ b/src/game/g_options.pas
g_touch_size := 1.0;
g_touch_fire := True;
g_touch_offset := 50;
+ g_touch_alt := False;
for i := 0 to e_MaxJoys-1 do
e_JoystickDeadzones[i] := 8192;
g_touch_size := Max(config.ReadInt('Touch', 'Size', 10) / 10, 0.1);
g_touch_fire := config.ReadBool('Touch', 'Fire', True);
g_touch_offset := Max(Min(config.ReadInt('Touch', 'Offset', 50), 100), 0);
+ g_touch_alt := config.ReadBool('Touch', 'Alt', False);
g_GFX_SetMax(Min(config.ReadInt('Game', 'MaxParticles', 1000), 50000));
g_Shells_SetMax(Min(config.ReadInt('Game', 'MaxShells', 300), 600));
config.WriteInt('Touch', 'Size', Round(g_touch_size * 10));
config.WriteBool('Touch', 'Fire', g_touch_fire);
config.WriteInt('Touch', 'Offset', Round(g_touch_offset));
+ config.WriteBool('Touch', 'Alt', g_touch_alt);
with config do
case gGibsCount of
diff --git a/src/game/g_touch.pas b/src/game/g_touch.pas
index 9256fb8e79411f362c9873beeb7dc11114c49086..1778eca23bfcbfd96762b2bfbcae92ee79153fba 100644 (file)
--- a/src/game/g_touch.pas
+++ b/src/game/g_touch.pas
SDL2;
var
- g_touch_size: Single = 1.0;
- g_touch_offset: Single = 50;
- g_touch_fire: Boolean = True;
+ g_touch_enabled: Boolean;
+ g_touch_size: Single;
+ g_touch_offset: Single;
+ g_touch_fire: Boolean;
+ g_touch_alt: Boolean;
procedure g_Touch_Init;
procedure g_Touch_ShowKeyboard(yes: Boolean);
e_log, e_graphics, e_input, g_options, g_game, g_main, g_weapons, g_console;
var
- jab: Boolean;
- enabled: Boolean;
angleFire: Boolean;
keyFinger: array [VK_FIRSTKEY..VK_LASTKEY] of Integer;
founded := true;
sz := Trunc(g_touch_size * dpi);
sw := gScreenWidth; sh := gScreenHeight;
- if jab then
+ if g_touch_alt then
begin
w := sz div 2; h := sz div 2;
case key of
VK_STATUS: begin x := sw div 2 - w div 2 + 0; y := 0 end;
VK_TEAM: begin x := sw div 2 - w div 2 + w; y := 0 end;
VK_PREV: begin x := 0; y := sh - 4*sz - 1; w := sz end;
- VK_NEXT: begin x := sw - w - 1; y := sh - 4*sz - 1; w := sz end;
+ VK_NEXT: begin x := sw - sz - 1; y := sh - 4*sz - 1; w := sz end;
else
w := sz; h := sz * 3;
case key of
procedure g_Touch_Init;
begin
{$IFNDEF HEADLESS}
- enabled := SDL_GetNumTouchDevices() > 0
+ g_touch_enabled := SDL_GetNumTouchDevices() > 0
{$ENDIF}
end;
procedure g_Touch_ShowKeyboard(yes: Boolean);
begin
{$IFNDEF HEADLESS}
- if not enabled then
+ if not g_touch_enabled then
Exit;
if yes then
var
x, y, i, finger: Integer;
begin
- if not enabled then
+ if not g_touch_enabled then
Exit;
if SDL_IsTextInputActive() = SDL_True then
Exit;
founded: Boolean;
begin
{$IFNDEF HEADLESS}
- if not enabled then
+ if not g_touch_enabled then
Exit;
if SDL_IsTextInputActive() = SDL_True then
Exit;
end;
initialization
- conRegVar('touch_enable', @enabled, 'enable/disable virtual buttons', 'draw buttons');
+ conRegVar('touch_enable', @g_touch_enabled, 'enable/disable virtual buttons', 'draw buttons');
conRegVar('touch_fire', @g_touch_fire, 'enable/disable fire when press virtual up/down', 'fire when press up/down');
conRegVar('touch_size', @g_touch_size, 0.1, 10, 'size of virtual buttons', 'button size');
conRegVar('touch_offset', @g_touch_offset, 0, 100, '', '');
- conRegVar('touch_alt', @jab, 'althernative virtual buttons layout', 'althernative layout');
+ conRegVar('touch_alt', @g_touch_alt, 'althernative virtual buttons layout', 'althernative layout');
end.