Extract hard-coded FPS limiter with parameter.
This commit is contained in:
committed by
Gustas
parent
2a223363b8
commit
0528ef58b2
@@ -65,6 +65,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
[TranslationReference]
|
[TranslationReference]
|
||||||
const string Disabled = "options-target-lines.disabled";
|
const string Disabled = "options-target-lines.disabled";
|
||||||
|
|
||||||
|
[TranslationReference("fps")]
|
||||||
|
const string FrameLimiter = "checkbox-frame-limiter";
|
||||||
static readonly int OriginalVideoDisplay;
|
static readonly int OriginalVideoDisplay;
|
||||||
static readonly WindowMode OriginalGraphicsMode;
|
static readonly WindowMode OriginalGraphicsMode;
|
||||||
static readonly int2 OriginalGraphicsWindowedSize;
|
static readonly int2 OriginalGraphicsWindowedSize;
|
||||||
@@ -229,7 +231,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var frameLimitGamespeedCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_GAMESPEED_CHECKBOX");
|
var frameLimitGamespeedCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_GAMESPEED_CHECKBOX");
|
||||||
var frameLimitCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_CHECKBOX");
|
var frameLimitCheckbox = panel.Get<CheckboxWidget>("FRAME_LIMIT_CHECKBOX");
|
||||||
var frameLimitOrigLabel = frameLimitCheckbox.Text;
|
var frameLimitOrigLabel = frameLimitCheckbox.Text;
|
||||||
var frameLimitLabel = new CachedTransform<int, string>(fps => frameLimitOrigLabel + $" ({fps} FPS)");
|
var frameLimitLabel = new CachedTransform<int, string>(fps => TranslationProvider.GetString(FrameLimiter, Translation.Arguments("fps", fps)));
|
||||||
frameLimitCheckbox.GetText = () => frameLimitLabel.Update(ds.MaxFramerate);
|
frameLimitCheckbox.GetText = () => frameLimitLabel.Update(ds.MaxFramerate);
|
||||||
frameLimitCheckbox.IsDisabled = () => ds.CapFramerateToGameFps;
|
frameLimitCheckbox.IsDisabled = () => ds.CapFramerateToGameFps;
|
||||||
|
|
||||||
|
|||||||
@@ -288,7 +288,6 @@ Container@DISPLAY_PANEL:
|
|||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Enable Frame Limiter
|
|
||||||
Container@FRAME_LIMIT_SLIDER_CONTAINER:
|
Container@FRAME_LIMIT_SLIDER_CONTAINER:
|
||||||
Width: PARENT_RIGHT / 2 - 20
|
Width: PARENT_RIGHT / 2 - 20
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -297,7 +297,6 @@ Container@DISPLAY_PANEL:
|
|||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Enable Frame Limiter
|
|
||||||
Container@FRAME_LIMIT_SLIDER_CONTAINER:
|
Container@FRAME_LIMIT_SLIDER_CONTAINER:
|
||||||
Width: PARENT_RIGHT / 2 - 20
|
Width: PARENT_RIGHT / 2 - 20
|
||||||
Children:
|
Children:
|
||||||
|
|||||||
@@ -353,6 +353,8 @@ options-target-lines =
|
|||||||
.manual = Manual
|
.manual = Manual
|
||||||
.disabled = Disabled
|
.disabled = Disabled
|
||||||
|
|
||||||
|
checkbox-frame-limiter = Enable Frame Limiter ({ $fps } FPS)
|
||||||
|
|
||||||
## HotkeysSettingsLogic
|
## HotkeysSettingsLogic
|
||||||
label-original-notice = The default is "{ $key }"
|
label-original-notice = The default is "{ $key }"
|
||||||
label-duplicate-notice = This is already used for "{ $key }" in the { $context } context
|
label-duplicate-notice = This is already used for "{ $key }" in the { $context } context
|
||||||
|
|||||||
Reference in New Issue
Block a user