X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fgame%2Fg_menu.pas;h=23fbf2e947c3f77ac7a455db154a71b120ad6c97;hb=ded89321df07e3f5832331127637375840c25e6f;hp=35a4a0b473d3f03bd102de176efe607f010f89b4;hpb=4ac477a64781436f4518e96009c3eef29979290b;p=d2df-sdl.git diff --git a/src/game/g_menu.pas b/src/game/g_menu.pas index 35a4a0b..23fbf2e 100644 --- a/src/game/g_menu.pas +++ b/src/game/g_menu.pas @@ -42,11 +42,7 @@ var implementation uses -{$IFDEF USE_NANOGL} - nanoGL, -{$ELSE} - GL, GLExt, -{$ENDIF} + {$INCLUDE ../nogl/noGLuses.inc} g_gui, g_textures, e_graphics, g_main, g_window, g_game, g_map, g_basic, g_console, g_sound, g_gfx, g_player, g_options, g_weapons, e_log, SysUtils, CONFIG, g_playermodel, DateUtils, sdl2, @@ -258,11 +254,13 @@ begin 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; menu := TGUIMenu(g_GUI_GetWindow('OptionsPlayersP1Menu').GetControl('mOptionsPlayersP1Menu')); @@ -288,8 +286,8 @@ begin gPlayer2Settings.Color := Model.Color; end; - if gPlayer1Settings.Name = '' then gPlayer1Settings.Name := 'Player1'; - if gPlayer2Settings.Name = '' then gPlayer2Settings.Name := 'Player2'; + if gPlayer1Settings.Name = '' then gPlayer1Settings.Name := GenPlayerName(1); + if gPlayer2Settings.Name = '' then gPlayer2Settings.Name := GenPlayerName(2); if g_Game_IsServer then begin @@ -453,12 +451,15 @@ begin 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; + TGUIScroll(menu.GetControl('scTouchOffset')).Value := Round(g_touch_offset / 5); end; menu := TGUIMenu(g_GUI_GetWindow('OptionsControlsMenu').GetControl('mOptionsControlsMenu')); @@ -763,6 +764,7 @@ begin end else slWaitStr := _lc[I_NET_SLIST_ERROR]; + g_Serverlist_GenerateTable(slCurrent, slTable); end; procedure ProcStartCampaign(); @@ -1290,7 +1292,9 @@ var 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; procedure ProcOptionsPlayersMIMenu(); @@ -2739,7 +2743,7 @@ begin 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'); @@ -2824,6 +2828,13 @@ begin 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'; @@ -2836,6 +2847,12 @@ begin AddItem(_lc[I_MENU_NO]); AddItem(_lc[I_MENU_YES]); end; + with AddScroll(_lc[I_MENU_CONTROL_TOUCH_OFFSET]) do + begin + Name := 'scTouchOffset'; + Max := 20; + OnChange := ProcChangeTouchSettings; + end; end; Menu.DefControl := 'mOptionsControlsTouchMenu'; g_GUI_AddWindow(Menu);