Skip to content

Commit 1767878

Browse files
committed
[settings] Localize Spring.SetConfigInt
1 parent 8191bde commit 1767878

1 file changed

Lines changed: 36 additions & 35 deletions

File tree

LuaMenu/widgets/gui_settings_window.lua

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ end
1717
--------------------------------------------------------------------------------
1818
--------------------------------------------------------------------------------
1919
-- Local Variables
20+
local spSetConfigInt = Spring.SetConfigInt
2021

2122
local battleStartDisplay = 1
2223
local lobbyFullscreen = 1
@@ -87,7 +88,7 @@ local function SaveWindowPos(width, height, x, y)
8788
end
8889

8990
-- WindowState is not saved by Spring. See https://springrts.com/mantis/view.php?id=5624
90-
Spring.SetConfigInt("WindowState", (x == 0 and 1) or 0, false)
91+
spSetConfigInt("WindowState", (x == 0 and 1) or 0, false)
9192
end
9293

9394
local function EnableProfilerFunc(newState)
@@ -230,22 +231,22 @@ local function SetLobbyFullscreenMode(mode, borderOverride)
230231
-- Required to remove FUDGE
231232
currentManualBorderless = false
232233

233-
Spring.SetConfigInt("Fullscreen", 1)
234+
spSetConfigInt("Fullscreen", 1)
234235

235-
Spring.SetConfigInt("XResolutionWindowed", screenX - FUDGE*2, false)
236-
Spring.SetConfigInt("YResolutionWindowed", screenY - FUDGE*2, false)
237-
Spring.SetConfigInt("WindowPosX", FUDGE, false)
238-
Spring.SetConfigInt("WindowPosY", FUDGE, false)
236+
spSetConfigInt("XResolutionWindowed", screenX - FUDGE*2, false)
237+
spSetConfigInt("YResolutionWindowed", screenY - FUDGE*2, false)
238+
spSetConfigInt("WindowPosX", FUDGE, false)
239+
spSetConfigInt("WindowPosY", FUDGE, false)
239240

240-
Spring.SetConfigInt("WindowBorderless", 1, false)
241-
Spring.SetConfigInt("Fullscreen", 0, false)
241+
spSetConfigInt("WindowBorderless", 1, false)
242+
spSetConfigInt("Fullscreen", 0, false)
242243
elseif mode == 2 then -- Windowed
243244
local winSizeX, winSizeY, winPosX, winPosY = Spring.GetViewGeometry()
244245
winPosX = Configuration.window_WindowPosX or winPosX
245246
winSizeX = Configuration.window_XResolutionWindowed or winSizeX
246247
winSizeY = Configuration.window_YResolutionWindowed or winSizeY
247-
Spring.SetConfigInt("WindowBorderless", 0, false)
248-
Spring.SetConfigInt("Fullscreen", 0)
248+
spSetConfigInt("WindowBorderless", 0, false)
249+
spSetConfigInt("Fullscreen", 0)
249250

250251
if Configuration.window_WindowPosY then
251252
winPosY = Configuration.window_WindowPosY
@@ -255,23 +256,23 @@ local function SetLobbyFullscreenMode(mode, borderOverride)
255256

256257
if winPosY > 10 then
257258
-- Window is not stuck at the top of the screen
258-
Spring.SetConfigInt("WindowPosX", math.min(winPosX, screenX - 50), false)
259-
Spring.SetConfigInt("WindowPosY", math.min(winPosY, screenY - 50), false)
260-
Spring.SetConfigInt("XResolutionWindowed", math.min(winSizeX, screenX), false)
261-
Spring.SetConfigInt("YResolutionWindowed", math.min(winSizeY, screenY - 50), false)
259+
spSetConfigInt("WindowPosX", math.min(winPosX, screenX - 50), false)
260+
spSetConfigInt("WindowPosY", math.min(winPosY, screenY - 50), false)
261+
spSetConfigInt("XResolutionWindowed", math.min(winSizeX, screenX), false)
262+
spSetConfigInt("YResolutionWindowed", math.min(winSizeY, screenY - 50), false)
262263
else
263264
-- Reset window to screen centre
264-
Spring.SetConfigInt("WindowPosX", screenX/4, false)
265-
Spring.SetConfigInt("WindowPosY", screenY/8, false)
266-
Spring.SetConfigInt("XResolutionWindowed", screenX/2, false)
267-
Spring.SetConfigInt("YResolutionWindowed", screenY*3/4, false)
265+
spSetConfigInt("WindowPosX", screenX/4, false)
266+
spSetConfigInt("WindowPosY", screenY/8, false)
267+
spSetConfigInt("XResolutionWindowed", screenX/2, false)
268+
spSetConfigInt("YResolutionWindowed", screenY*3/4, false)
268269
end
269-
Spring.SetConfigInt("WindowBorderless", 0, false)
270-
Spring.SetConfigInt("Fullscreen", 0)
270+
spSetConfigInt("WindowBorderless", 0, false)
271+
spSetConfigInt("Fullscreen", 0)
271272
elseif mode == 3 then -- Fullscreen
272-
Spring.SetConfigInt("XResolution", screenX, false)
273-
Spring.SetConfigInt("YResolution", screenY, false)
274-
Spring.SetConfigInt("Fullscreen", 1, false)
273+
spSetConfigInt("XResolution", screenX, false)
274+
spSetConfigInt("YResolution", screenY, false)
275+
spSetConfigInt("Fullscreen", 1, false)
275276
elseif mode == 4 or mode == 6 then -- Manual Borderless and windowed
276277
local borders = borderOverride
277278
if not borders then
@@ -284,26 +285,26 @@ local function SetLobbyFullscreenMode(mode, borderOverride)
284285
end
285286
currentManualBorderless = Spring.Utilities.CopyTable(borders)
286287

287-
Spring.SetConfigInt("Fullscreen", (mode == 4 and 1) or 0)
288+
spSetConfigInt("Fullscreen", (mode == 4 and 1) or 0)
288289

289-
Spring.SetConfigInt("XResolutionWindowed", borders.width or (screenX - FUDGE*2), false)
290-
Spring.SetConfigInt("YResolutionWindowed", borders.height or (screenY - FUDGE*2), false)
291-
Spring.SetConfigInt("WindowPosX", borders.x or FUDGE, false)
292-
Spring.SetConfigInt("WindowPosY", borders.y or FUDGE, false)
290+
spSetConfigInt("XResolutionWindowed", borders.width or (screenX - FUDGE*2), false)
291+
spSetConfigInt("YResolutionWindowed", borders.height or (screenY - FUDGE*2), false)
292+
spSetConfigInt("WindowPosX", borders.x or FUDGE, false)
293+
spSetConfigInt("WindowPosY", borders.y or FUDGE, false)
293294

294-
Spring.SetConfigInt("WindowBorderless", (mode == 4 and 1) or 0, false)
295+
spSetConfigInt("WindowBorderless", (mode == 4 and 1) or 0, false)
295296

296-
Spring.SetConfigInt("Fullscreen", 0, false)
297+
spSetConfigInt("Fullscreen", 0, false)
297298
elseif mode == 5 then -- Manual Fullscreen
298299
local resolution
299300
if inLobby then
300301
resolution = WG.Chobby.Configuration.manualFullscreen.lobby or {}
301302
else
302303
resolution = WG.Chobby.Configuration.manualFullscreen.game or {}
303304
end
304-
Spring.SetConfigInt("XResolution", resolution.width or screenX, false)
305-
Spring.SetConfigInt("YResolution", resolution.height or screenY, false)
306-
Spring.SetConfigInt("Fullscreen", 1, false)
305+
spSetConfigInt("XResolution", resolution.width or screenX, false)
306+
spSetConfigInt("YResolution", resolution.height or screenY, false)
307+
spSetConfigInt("Fullscreen", 1, false)
307308
end
308309

309310
if delayedModeSet == mode and delayedBorderOverride then
@@ -313,8 +314,8 @@ local function SetLobbyFullscreenMode(mode, borderOverride)
313314
delayedModeSet = mode
314315
delayedBorderOverride = borderOverride
315316
currentMode = 2
316-
Spring.SetConfigInt("WindowBorderless", 0, false)
317-
Spring.SetConfigInt("Fullscreen", 0)
317+
spSetConfigInt("WindowBorderless", 0, false)
318+
spSetConfigInt("Fullscreen", 0)
318319
WG.Delay(SetLobbyFullscreenMode, 0.8)
319320
end
320321
end

0 commit comments

Comments
 (0)