Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_VideoSettingsSubMenu.c
Go to the documentation of this file.
2 {
3  FULLSCREEN = 0, // keep order in the enum
7 };
8 
9 /*
10 enum EAspectRatio
11 {
12  ASPECT_RATIO_AUTO = 0, // keep order in the enum
13  ASPECT_RATIO_16_9,
14  ASPECT_RATIO_16_10,
15  ASPECT_RATIO_4_3,
16  ASPECT_RATIO_5_4,
17  ASPECT_RATIO_32_9,
18  ASPECT_RATIO_48_9,
19 };
20 // */
21 
23 {
24  protected ref array<int> m_aWidths = {};
25  protected ref array<int> m_aHeights = {};
26  protected ref array<int> m_aAAvalues = { 0, 2, 4, 8, 16, 32 };
27 
28  protected SCR_ComboBoxComponent m_ResolutionCombo;
29  protected SCR_SliderComponent m_ResolutionScale;
30  // protected SCR_ComboBoxComponent m_AspectRatio;
31  protected SCR_SpinBoxComponent m_WindowMode;
32  protected SCR_SpinBoxComponent m_MaxFPS;
33 
34  protected string m_sResolutionScaleLocalisation;
35 
36  protected UserSettings m_Video;
37  protected UserSettings m_Pipeline;
38  protected UserSettings m_ResourceManager;
39 
40  protected static const string RESOLUTION_FORMAT = "%1 × %2";
41  protected static const int CUSTOM_PRESET_INDEX = 4; // 4 is the custom option for quality preset
42 
44  protected static const ref array<string> PRESET_SETTINGS = {
45  /*
46  the following settings are out of presets; they were not forgotten:
47  "WindowMode"
48  "Resolution"
49  "ResolutionScale"
50  "AspectRatio"
51  "VSync"
52  "MaxFPS"
53  "DOF" // scripted
54  "NearDOF" // scripted
55  */
56  "Detail",
57  "DistantShadows",
58  "EnvironmentQuality",
59  "FoliageSmoothing",
60  "GeometricDetail",
61  "GrassDistance",
62  "GrassLOD",
63  "HardwareAA",
64  "HBAO", // ambient occlusion
65  "ObjectDrawDistance",
66  "PostprocessAA",
67  "RenderTargetFormat",
68  "ShadowQuality",
69  "SSDO", // contact shadow
70  "SSR", // post-process quality
71  // "TerrainDetail", //disabled setting for now
72  "TerrainSurfaceDetail",
73  "TextureDetail",
74  "TextureFiltering",
75  };
76 
77  //------------------------------------------------------------------------------------------------
78  override void OnMenuItemChanged(SCR_SettingsBindingBase binding)
79  {
80  // ignore this if we are loading settings
81  if (m_bLoadingSettings)
82  return;
83 
84  if (binding)
85  SetQualityPresetIndex(binding.GetWidgetName());
86 
87  super.OnMenuItemChanged(binding);
88  }
89 
90  //------------------------------------------------------------------------------------------------
91  protected void OnCustomMenuItemChanged(string widgetName)
92  {
93  OnMenuItemChanged(new SCR_SettingsBindingBase("", "", widgetName));
94  }
95 
96  //------------------------------------------------------------------------------------------------
97  protected void SetQualityPresetIndex(string changedSetting)
98  {
99  if (!PRESET_SETTINGS.Contains(changedSetting))
100  return;
101 
102  SCR_ComboBoxComponent qualityPreset = SCR_ComboBoxComponent.GetComboBoxComponent("QualityPreset", m_wRoot);
103  if (qualityPreset)
104  qualityPreset.SetCurrentItem(CUSTOM_PRESET_INDEX);
105 
106  BaseContainer display = GetGame().GetEngineUserSettings().GetModule("DisplayUserSettings");
107  display.Set("OverallQuality", CUSTOM_PRESET_INDEX);
108  }
109 
110  //------------------------------------------------------------------------------------------------
111  override void OnTabCreate(Widget menuRoot, ResourceName buttonsLayout, int index)
112  {
113  super.OnTabCreate(menuRoot, buttonsLayout, index);
114 
115  m_ResourceManager = GetGame().GetEngineUserSettings().GetModule("ResourceManagerUserSettings");
116  m_Pipeline = GetGame().GetEngineUserSettings().GetModule("PipelineUserSettings");
117  m_Video = GetGame().GetEngineUserSettings().GetModule("VideoUserSettings");
118 
119  m_ResolutionScale = SCR_SliderComponent.GetSliderComponent("ResolutionScale", m_wRoot);
120  m_ResolutionCombo = SCR_ComboBoxComponent.GetComboBoxComponent("Resolution", m_wRoot);
121  // m_AspectRatio = SCR_ComboBoxComponent.GetComboBoxComponent("AspectRatio", m_wRoot);
122  m_WindowMode = SCR_SpinBoxComponent.GetSpinBoxComponent("WindowMode", m_wRoot);
123  m_MaxFPS = SCR_SpinBoxComponent.GetSpinBoxComponent("MaxFPS", m_wRoot);
124 
125  SCR_ComboBoxComponent aspectRatio = SCR_ComboBoxComponent.GetComboBoxComponent("AspectRatio", m_wRoot);
126  if (aspectRatio)
127  aspectRatio.SetVisible(false);
128 
129  // Create bindings and load all standard entries
130  m_aSettingsBindings.Clear();
131 
132  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("ResourceManagerUserSettings", "GeometricDetail", "GeometricDetail"));
133  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("TerrainGenMaterialSettings", "GeometryLevel", "TerrainDetail"));
134  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("VideoUserSettings", "Vsynch", "VSync"));
135 
136  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("GrassMaterialSettings", "Lod", "GrassLOD"));
137  // We are using game settings to be able to override distance of grass
138  //m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("GrassMaterialSettings", "Distance", "GrassDistance"));
139  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("TerrainGenMaterialSettings", "Detail", "TerrainSurfaceDetail"));
140  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("MaterialSystemUserSettings", "TextureFilter", "TextureFiltering"));
141 
142  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("GraphicsQualitySettings", "ObjectDrawDistanceScale", "ObjectDrawDistance"));
143  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("VideoUserSettings", "Atoc", "FoliageSmoothing"));
144  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("VideoUserSettings", "ResolutionScale", "ResolutionScale"));
145  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("VideoUserSettings", "FsrEnabled", "FSR"));
146  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("VideoUserSettings", "RenderFormat", "RenderTargetFormat"));
147  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("VideoUserSettings", "DistantShadowsQuality", "DistantShadows"));
148  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("VideoUserSettings", "EnvironmentQuality", "EnvironmentQuality"));
149  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("DisplayUserSettings", "OverallQuality", "QualityPreset"));
150 
151  // Post-process settings
152  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("DisplayUserSettings", "PPAA", "PostprocessAA", "PPQuality"));
153  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("DisplayUserSettings", "HBAO", "HBAO", "PPQuality"));
154  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("DisplayUserSettings", "SSDO", "SSDO", "PPQuality"));
155  m_aSettingsBindings.Insert(new SCR_SettingBindingEngine("DisplayUserSettings", "SSR", "SSR", "PPQuality"));
156  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_VideoSettings", "m_iDofType", "DOF"));
157  m_aSettingsBindings.Insert(new SCR_SettingBindingGameplay("SCR_VideoSettings", "m_bNearDofEffect", "NearDOF"));
158 
159  LoadSettings();
160 
161  SetupQualityPreset();
162  SetupViewDistance();
163  SetupGrassDistance();
164  SetupResolution();
165  SetupResolutionScale();
166  SetupShadowQuality();
167  SetupHardwareAA();
168  SetupTextureDetail();
169  SetupMaxFPS();
170 
171  RemoveQualityPresetFocus();
172 
173  // TODO: bind OnRenderResolutionChanged when Alt+Enter event (non-existing atm) is triggered
174  }
175 
176  //------------------------------------------------------------------------------------------------
177  protected void SetupTextureDetail(bool isInit = true)
178  {
179  if (!m_ResourceManager)
180  return;
181 
182  SCR_SpinBoxComponent textureDetail = SCR_SpinBoxComponent.GetSpinBoxComponent("TextureDetail", m_wRoot);
183  if (!textureDetail)
184  return;
185 
186  float value, min, max, step, item;
187  m_ResourceManager.Get("TextureDetail", value);
188  m_ResourceManager.GetLimits(item, min, max, step);
189 
190  int current = (max - value);
191  textureDetail.SetCurrentItem(current);
192 
193  if (isInit)
194  textureDetail.m_OnChanged.Insert(OnTextureDetailChanged);
195  }
196 
197  //------------------------------------------------------------------------------------------------
199  protected void OnMaxFPSChanged(SCR_SpinBoxComponent comp, int i)
200  {
201  if (!comp || !m_MaxFPS || !m_Video)
202  return;
203 
204  bool isEnabled = m_MaxFPS.GetCurrentIndex();
205 
206  int value = 0;
207  if (isEnabled)
208  value = m_MaxFPS.GetCurrentItem().ToInt();
209 
210  m_Video.Set("MaxFps", value);
211 
212  OnCustomMenuItemChanged("MaxFPS");
213  }
214 
215  //------------------------------------------------------------------------------------------------
217  protected void OnTextureDetailChanged(SCR_SpinBoxComponent comp, int i)
218  {
219  if (!m_ResourceManager)
220  return;
221 
222  float min, max, step, item;
223  m_ResourceManager.GetLimits(item, min, max, step);
224 
225  int current = max - i;
226  m_ResourceManager.Set("TextureDetail", current);
227 
228  OnCustomMenuItemChanged("TextureDetail");
229  }
230 
231  //------------------------------------------------------------------------------------------------
232  protected void OnQualityPresetChanged(SCR_ComboBoxComponent combobox, int itemIndex)
233  {
234  if (m_bLoadingSettings)
235  return;
236 
237  if (combobox.GetCurrentIndex() == CUSTOM_PRESET_INDEX)
238  return;
239 
240  GetGame().ApplySettingsPreset();
241  GetGame().UserSettingsChanged();
242  LoadSettings(true, false);
243 
244  // all scripted widgets have to be manually done here
245  m_bLoadingSettings = true;
246 
247  SetupHardwareAA(false);
248  SetupTextureDetail(false);
249  SetupShadowQuality(false);
250 
251  m_bLoadingSettings = false;
252  }
253 
254  //------------------------------------------------------------------------------------------------
255  protected void SetupQualityPreset()
256  {
257  SCR_ComboBoxComponent qualityPreset = SCR_ComboBoxComponent.GetComboBoxComponent("QualityPreset", m_wRoot);
258  if (!qualityPreset)
259  return;
260 
261  qualityPreset.m_OnChanged.Insert(OnQualityPresetChanged);
262  }
263 
264  //------------------------------------------------------------------------------------------------
265  protected void SetupHardwareAA(bool isInit = true)
266  {
267  if (!m_Video)
268  return;
269 
270  SCR_SpinBoxComponent antiAliasing = SCR_SpinBoxComponent.GetSpinBoxComponent("HardwareAA", m_wRoot);
271  if (!antiAliasing)
272  return;
273 
274 //#ifdef PLATFORM_CONSOLE
275  // TODO: ifdefs are ugly and messy, make proper solution using menu configs and UI prefabs
276  //antiAliasing.GetRootWidget().SetVisible(false);
277  //return;
278 //#endif
279 
280  int value;
281  m_Video.Get("Fsaa", value);
282 
283  int i = m_aAAvalues.Find(value);
284  if (i > -1)
285  antiAliasing.SetCurrentItem(i);
286 
287  if (isInit)
288  antiAliasing.m_OnChanged.Insert(OnHardwareAAChanged);
289 
290  SCR_SpinBoxComponent foliageSmoothing = SCR_SpinBoxComponent.GetSpinBoxComponent("FoliageSmoothing", m_wRoot);
291  if (foliageSmoothing && i == 0)
292  foliageSmoothing.SetEnabled(false);
293  }
294 
295  //------------------------------------------------------------------------------------------------
297  protected void OnHardwareAAChanged(SCR_SpinBoxComponent comp, int i)
298  {
299  if (!m_Video || i < 0 || i >= m_aAAvalues.Count())
300  return;
301 
302  m_Video.Set("Fsaa", m_aAAvalues[i]);
303 
304  SCR_SpinBoxComponent foliageSmoothing = SCR_SpinBoxComponent.GetSpinBoxComponent("FoliageSmoothing", m_wRoot);
305  if (foliageSmoothing)
306  foliageSmoothing.SetEnabled(i > 0);
307 
308  OnCustomMenuItemChanged("HardwareAA");
309  }
310 
311  //------------------------------------------------------------------------------------------------
313  protected void OnResolutionScaleChanged(SCR_SliderComponent comp, float value)
314  {
315  value = Math.Round(value * 100);
316 
317  comp.ShowCustomValue(value.ToString());
318 
319  OnRenderResolutionChanged();
320 
321  OnCustomMenuItemChanged("ResolutionScale");
322  }
323 
324  //------------------------------------------------------------------------------------------------
326  protected void OnRenderResolutionChanged()
327  {
328  if (!m_ResolutionScale || !m_sResolutionScaleLocalisation)
329  return;
330 
331  TextWidget labelWidget = m_ResolutionScale.GetLabel();
332  if (!labelWidget)
333  return;
334 
335  float uiResWidth, uiResHeight;
336  int renderResWidth, renderResHeight;
337  GetGame().GetWorkspace().GetScreenSize(uiResWidth, uiResHeight);
338  float scale = m_ResolutionScale.GetValue();
339  renderResWidth = Math.Round(uiResWidth * scale);
340  renderResHeight = Math.Round(uiResHeight * scale);
341 
342  labelWidget.SetTextFormat(m_sResolutionScaleLocalisation, renderResWidth, renderResHeight);
343  }
344 
345  //------------------------------------------------------------------------------------------------
347  protected void OnShadowDetailChanged(SCR_SpinBoxComponent comp, int i)
348  {
349  if (!m_Pipeline)
350  return;
351 
352  m_Pipeline.Set("ShadowQuality", i + 1);
353  OnCustomMenuItemChanged("ShadowQuality");
354  }
355 
356  //------------------------------------------------------------------------------------------------
358  protected void OnViewDistanceChanged(SCR_SliderComponent comp, float value)
359  {
360  GetGame().SetViewDistance(value);
361  // Get desired type of DOF
362  BaseContainer m_VideoSettings = GetGame().GetGameUserSettings().GetModule("SCR_VideoSettings");
363  if (m_VideoSettings)
364  {
365  m_VideoSettings.Set("m_iViewDistance", value);
366  }
367  OnCustomMenuItemChanged("DrawDistance");
368  }
369 
370  //------------------------------------------------------------------------------------------------
371  protected void OnGrassDistanceChanged(SCR_SliderComponent comp, float value)
372  {
373  GetGame().SetGrassDistance(value);
374  OnCustomMenuItemChanged("GrassDistance");
375  }
376 
377  //------------------------------------------------------------------------------------------------
379  protected void OnWindowModeChanged(SCR_SpinBoxComponent comp, int index)
380  {
381  if (!m_Video || !m_ResolutionCombo || !m_ResolutionScale)
382  return;
383 
384  bool borderlessFullscreen = (index == 0);
385 
386  m_ResolutionCombo.GetRootWidget().SetVisible(!borderlessFullscreen);
387  m_ResolutionScale.GetRootWidget().SetVisible(borderlessFullscreen);
388 
389  int nativeWidth, nativeHeight;
390  float scale;
391 
392  if (borderlessFullscreen)
393  {
394  // Set to borderless fulscreen
395  m_Video.Set("WindowMode", EWindowMode.BORDERLESS);
396 
397  SCR_ComboBoxComponent combo = SCR_ComboBoxComponent.GetComboBoxComponent("Resolution", m_wRoot);
398  if (!combo)
399  return;
400 
401  System.GetNativeResolution(nativeWidth, nativeHeight);
402  int i = combo.GetCurrentIndex();
403  scale = m_aWidths[i] / nativeWidth;
404  m_Video.Set("ResolutionScale", scale);
405 
406  m_ResolutionScale.SetValue(scale);
407  }
408  else
409  {
410  // Set to windowed mode
411  m_Video.Set("WindowMode", EWindowMode.WINDOWED);
412 
413  m_Video.Get("ResolutionScale", scale);
414  System.GetNativeResolution(nativeWidth, nativeHeight);
415 
416  int width = nativeWidth * scale;
417  int bestDiff = int.MAX;
418  int bestIdx = 0;
419 
420  for (int i, cnt = m_aWidths.Count(); i < cnt; i++)
421  {
422  int diff = Math.AbsInt(m_aWidths[i] - width);
423 
424  if (diff < bestDiff)
425  {
426  bestDiff = diff;
427  bestIdx = i;
428 
429  if (diff == 0)
430  break;
431  }
432  }
433 
434  m_Video.Set("ScreenWidth", m_aWidths[bestIdx]);
435  m_Video.Set("ScreenHeight", m_aHeights[bestIdx]);
436  m_Video.Set("ResolutionScale", 1.0);
437 
438  SetResolutionCombo(m_ResolutionCombo);
439  }
440 
441  OnCustomMenuItemChanged("WindowMode");
442  }
443 
444  //------------------------------------------------------------------------------------------------
445  protected void SetResolutionCombo(SCR_ComboBoxComponent combo)
446  {
447  if (!m_Video)
448  return;
449 
450  int scale, nativeWidth, nativeHeight, width, height;
451  m_Video.Get("ResolutionScale", scale);
452  m_Video.Get("ScreenWidth", width);
453  m_Video.Get("ScreenHeight", height);
454  System.GetNativeResolution(nativeWidth, nativeHeight);
455 
456  width = width * scale;
457  height = height * scale;
458  int bestDiff = int.MAX;
459  int bestIdx = 0;
460 
461  for (int i, cnt = m_aWidths.Count(); i < cnt; i++)
462  {
463  int diff = Math.AbsInt(m_aWidths[i] - width);
464 
465  if (diff < bestDiff)
466  {
467  bestDiff = diff;
468  bestIdx = i;
469  if (diff == 0)
470  break;
471  }
472  }
473 
474  int bestDiffH = int.MAX;
475  int bestIdxH = 0;
476 
477  for (int i, cnt = m_aHeights.Count(); i < cnt; i++)
478  {
479  int diff = Math.AbsInt(m_aHeights[i] - height);
480 
481  if (diff < bestDiffH)
482  {
483  bestDiffH = diff;
484  bestIdxH = i;
485  if (diff == 0)
486  break;
487  }
488  }
489 
490  string resolutionStr = string.Format(RESOLUTION_FORMAT, m_aWidths[bestIdx], m_aHeights[bestIdxH]);
491 
492  foreach (int i, string elementName : combo.m_aElementNames)
493  {
494  if (elementName != resolutionStr)
495  continue;
496 
497  combo.SetCurrentItem(i);
498  return;
499  }
500  }
501 
502  //------------------------------------------------------------------------------------------------
503  protected void SetupViewDistance()
504  {
505  float viewDistance;
506  SCR_SliderComponent distance = SCR_SliderComponent.GetSliderComponent("DrawDistance", m_wRoot);
507  if (!distance)
508  return;
509 
510  float min = GetGame().GetMinimumViewDistance();
511  float max = GetGame().GetMaximumViewDistance();
512 
513  // Get desired type of DOF
514  BaseContainer m_VideoSettings = GetGame().GetGameUserSettings().GetModule("SCR_VideoSettings");
515  if (m_VideoSettings)
516  {
517  m_VideoSettings.Get("m_iViewDistance", viewDistance);
518  GetGame().SetViewDistance(viewDistance);
519  }
520 
521  float current = GetGame().GetViewDistance();
522  distance.SetMin(min);
523  distance.SetMax(max);
524  distance.SetStep(50);
525 
526  distance.SetValue(current);
527  distance.GetOnChangedFinal().Insert(OnViewDistanceChanged);
528  }
529 
530  //------------------------------------------------------------------------------------------------
531  protected void SetupGrassDistance()
532  {
533  SCR_SliderComponent distance = SCR_SliderComponent.GetSliderComponent("GrassDistance", m_wRoot);
534  if (!distance)
535  return;
536 
537  int min = GetGame().GetMinimumGrassDistance();
538  int max = GetGame().GetMaximumGrassDistance();
539  int current = GetGame().GetGrassDistance();
540  distance.SetMin(min);
541  distance.SetMax(max);
542  distance.SetStep(1);
543 
544  distance.SetValue(current);
545  distance.GetOnChangedFinal().Insert(OnGrassDistanceChanged);
546  }
547 
548  //------------------------------------------------------------------------------------------------
549  protected void SetupShadowQuality(bool isInit = true)
550  {
551  if (!m_Pipeline)
552  return;
553  // Shadow detail quality is little special, because we want to skip the lowest setting
554  SCR_SpinBoxComponent shadowDetail = SCR_SpinBoxComponent.GetSpinBoxComponent("ShadowQuality", m_wRoot);
555  if (!shadowDetail)
556  return;
557 
558  int shadowQuality;
559  m_Pipeline.Get("ShadowQuality", shadowQuality);
560  shadowDetail.SetCurrentItem(Math.ClampInt(shadowQuality - 1, 0, shadowDetail.GetNumItems() - 1));
561 
562  if (isInit)
563  shadowDetail.m_OnChanged.Insert(OnShadowDetailChanged);
564  }
565 
566  //------------------------------------------------------------------------------------------------
567  protected void SetupResolution()
568  {
569  if (!m_ResolutionCombo || !m_ResolutionScale || !m_WindowMode || !m_Video)
570  return;
571 
572  int mode;
573  m_Video.Get("WindowMode", mode);
574 
575  // Hide resolutions if not in window mode
576 
577 #ifdef PLATFORM_CONSOLE
578  bool fullScreen = true;
579  bool showWindowMode = false;
580 #else
581  bool fullScreen = (mode != EWindowMode.WINDOWED);
582  bool showWindowMode = true;
583 #endif
584 
585 #ifdef WORKBENCH
586  fullScreen = true;
587  showWindowMode = false;
588 #endif
589 
590  if (showWindowMode)
591  {
592  m_WindowMode.SetCurrentItem(!fullScreen);
593  m_WindowMode.m_OnChanged.Insert(OnWindowModeChanged);
594  }
595 
596  m_WindowMode.GetRootWidget().SetVisible(showWindowMode);
597 
598  if (m_ResolutionScale)
599  m_ResolutionScale.GetRootWidget().SetVisible(fullScreen);
600  if (m_ResolutionCombo)
601  m_ResolutionCombo.GetRootWidget().SetVisible(!fullScreen);
602 
603  System.GetSupportedResolutions(m_aWidths, m_aHeights);
604  for (int i = 0, cnt = m_aWidths.Count(); i < cnt; i++)
605  {
606  m_ResolutionCombo.AddItem(string.Format(RESOLUTION_FORMAT, m_aWidths[i], m_aHeights[i]));
607  }
608 
609  SetResolutionCombo(m_ResolutionCombo);
610  m_ResolutionCombo.m_OnChanged.Insert(UpdateResolution);
611  }
612 
613  //------------------------------------------------------------------------------------------------
614  protected void SetupResolutionScale()
615  {
616  if (!m_ResolutionScale)
617  return;
618 
619  float scale = m_ResolutionScale.GetValue() * 100;
620  scale = Math.Round(scale);
621  m_ResolutionScale.ShowCustomValue(scale.ToString());
622 
623  TextWidget labelWidget = m_ResolutionScale.GetLabel();
624  if (labelWidget)
625  m_sResolutionScaleLocalisation = labelWidget.GetText();
626 
627  m_ResolutionScale.m_OnChanged.Insert(OnResolutionScaleChanged);
628  OnRenderResolutionChanged();
629  }
630 
631  //------------------------------------------------------------------------------------------------
634  protected void RemoveQualityPresetFocus()
635  {
636  ButtonWidget qualityPreset = ButtonWidget.Cast(m_wRoot.FindAnyWidget("QualityPreset"));
637  if (!qualityPreset)
638  return;
639 
640  VerticalLayoutWidget settingsEntries = VerticalLayoutWidget.Cast(m_wScroll.FindAnyWidget("SettingsEntries"));
641  if (!settingsEntries)
642  return;
643 
644  Widget child = settingsEntries.GetChildren();
645  while (child)
646  {
647  if (ButtonWidget.Cast(child))
648  {
649  GetGame().GetCallqueue().CallLater(GetGame().GetWorkspace().SetFocusedWidget, 0, false, child, false);
650  return;
651  }
652  child = child.GetSibling();
653  }
654  }
655 
656  //------------------------------------------------------------------------------------------------
658  protected void UpdateResolution(SCR_ComboBoxComponent resolution, int current)
659  {
660  if (!resolution || !m_Video)
661  return;
662 
663  m_Video.Set("ScreenWidth", m_aWidths[current]);
664  m_Video.Set("ScreenHeight", m_aHeights[current]);
665 
666  OnRenderResolutionChanged();
667 
668  OnCustomMenuItemChanged("Resolution");
669  }
670 
671  //------------------------------------------------------------------------------------------------
672  protected void SetupMaxFPS()
673  {
674  if (!m_Video || !m_MaxFPS)
675  return;
676 
677  int maxFPS;
678  m_Video.Get("MaxFps", maxFPS);
679 
680  if (maxFPS < 1)
681  {
682  m_MaxFPS.SetCurrentItem(0);
683  }
684  else
685  {
686  for (int i = 1, cnt = m_MaxFPS.GetNumItems(); i < cnt; i++)
687  {
688  if (m_MaxFPS.GetItemName(i).ToInt() == maxFPS)
689  {
690  m_MaxFPS.SetCurrentItem(i);
691  break;
692  }
693  }
694  }
695 
696  m_MaxFPS.m_OnChanged.Insert(OnMaxFPSChanged);
697  }
698 }
SCR_SettingsBindingBase
Definition: SCR_SettingsBindingBase.c:1
SCR_ComboBoxComponent
Definition: SCR_ComboBoxComponent.c:1
MAXIMIZED
@ MAXIMIZED
Definition: SCR_VideoSettingsSubMenu.c:5
m_wRoot
protected Widget m_wRoot
Definition: SCR_ScenarioFrameworkLayerTaskDefend.c:59
SCR_SettingBindingEngine
Definition: SCR_SettingBindingEngine.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
WINDOWED
@ WINDOWED
Definition: SCR_VideoSettingsSubMenu.c:4
EWindowMode
EWindowMode
Definition: SCR_VideoSettingsSubMenu.c:1
SCR_VideoSettingsSubMenu
Definition: SCR_VideoSettingsSubMenu.c:22
SCR_SettingBindingGameplay
Definition: SCR_SettingBindingGameplay.c:1
SCR_SliderComponent
Definition: SCR_SliderComponent.c:2
distance
float distance
Definition: SCR_DestructibleTreeV2.c:29
LoadSettings
protected void LoadSettings()
Definition: SCR_HintManagerComponent.c:449
BORDERLESS
@ BORDERLESS
Definition: SCR_VideoSettingsSubMenu.c:6
SCR_SpinBoxComponent
Definition: SCR_SpinBoxComponent.c:1
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
FULLSCREEN
@ FULLSCREEN
Definition: SCR_VideoSettingsSubMenu.c:3
SCR_SettingsSubMenuBase
Definition: SCR_SettingsSubMenuBase.c:1