expose hidden Debug settings to ra/d2k GUI

- performance text switch
- performace text update rate
- AI debug messages
- trait report threshold ticks
This commit is contained in:
Matthias Mailänder
2013-02-14 19:51:29 +01:00
parent ba8c9bb1b1
commit 6bbe5f633c
3 changed files with 59 additions and 6 deletions

View File

@@ -23,11 +23,12 @@ namespace OpenRA.Mods.RA.Widgets.Logic
// Perf text // Perf text
var perfText = perfRoot.Get<LabelWidget>("TEXT"); var perfText = perfRoot.Get<LabelWidget>("TEXT");
perfText.IsVisible = () => Game.Settings.Debug.PerfText;
perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F( perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F(
Game.RenderFrame, Game.RenderFrame,
Game.NetFrameNumber, Game.NetFrameNumber,
PerfHistory.items["render"].LastValue, PerfHistory.items["render"].Average(Game.Settings.Debug.Samples),
PerfHistory.items["tick_time"].LastValue, PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples),
Game.LocalTick, Game.LocalTick,
PerfHistory.items["batches"].LastValue); PerfHistory.items["batches"].LastValue);
} }

View File

@@ -195,14 +195,30 @@ namespace OpenRA.Mods.RA.Widgets.Logic
// Debug // Debug
var debug = bg.Get("DEBUG_PANE"); var debug = bg.Get("DEBUG_PANE");
var perfgraphCheckbox = debug.Get<CheckboxWidget>("PERFDEBUG_CHECKBOX"); var perfgraphCheckbox = debug.Get<CheckboxWidget>("PERFGRAPH_CHECKBOX");
perfgraphCheckbox.IsChecked = () => Game.Settings.Debug.PerfGraph; perfgraphCheckbox.IsChecked = () => Game.Settings.Debug.PerfGraph;
perfgraphCheckbox.OnClick = () => Game.Settings.Debug.PerfGraph ^= true; perfgraphCheckbox.OnClick = () => Game.Settings.Debug.PerfGraph ^= true;
var perftextCheckbox = debug.Get<CheckboxWidget>("PERFTEXT_CHECKBOX");
perftextCheckbox.IsChecked = () => Game.Settings.Debug.PerfText;
perftextCheckbox.OnClick = () => Game.Settings.Debug.PerfText ^= true;
var sampleSlider = debug.Get<SliderWidget>("PERFTEXT_SAMPLE_AMOUNT");
sampleSlider.Value = sampleSlider.MaximumValue-Game.Settings.Debug.Samples;
sampleSlider.OnChange += x => Game.Settings.Debug.Samples = (int)sampleSlider.MaximumValue-(int)Math.Round(x);
var checkunsyncedCheckbox = debug.Get<CheckboxWidget>("CHECKUNSYNCED_CHECKBOX"); var checkunsyncedCheckbox = debug.Get<CheckboxWidget>("CHECKUNSYNCED_CHECKBOX");
checkunsyncedCheckbox.IsChecked = () => Game.Settings.Debug.SanityCheckUnsyncedCode; checkunsyncedCheckbox.IsChecked = () => Game.Settings.Debug.SanityCheckUnsyncedCode;
checkunsyncedCheckbox.OnClick = () => Game.Settings.Debug.SanityCheckUnsyncedCode ^= true; checkunsyncedCheckbox.OnClick = () => Game.Settings.Debug.SanityCheckUnsyncedCode ^= true;
var botdebugCheckbox = debug.Get<CheckboxWidget>("BOTDEBUG_CHECKBOX");
botdebugCheckbox.IsChecked = () => Game.Settings.Debug.BotDebug;
botdebugCheckbox.OnClick = () => Game.Settings.Debug.BotDebug ^= true;
var longTickThreshold = debug.Get<SliderWidget>("LONG_TICK_THRESHOLD");
longTickThreshold.Value = Game.Settings.Debug.LongTickThreshold;
longTickThreshold.OnChange += x => Game.Settings.Debug.LongTickThreshold = x;
bg.Get<ButtonWidget>("BUTTON_CLOSE").OnClick = () => bg.Get<ButtonWidget>("BUTTON_CLOSE").OnClick = () =>
{ {
int x, y; int x, y;

View File

@@ -332,15 +332,51 @@ Background@SETTINGS_MENU:
Height:PARENT_BOTTOM - 100 Height:PARENT_BOTTOM - 100
Visible: false Visible: false
Children: Children:
Checkbox@PERFDEBUG_CHECKBOX: Checkbox@PERFGRAPH_CHECKBOX:
X:0 X:0
Y:0 Y:0
Width:300 Width:300
Height:20 Height:20
Text:Show Performance Information Text:Show Performance Graph
Checkbox@CHECKUNSYNCED_CHECKBOX: Checkbox@PERFTEXT_CHECKBOX:
X:0 X:0
Y:30 Y:30
Width:300 Width:300
Height:20 Height:20
Text:Show Performance Text
Label@PERFTEXT_SAMPLE_LABEL:
X:30
Y:70
Text:Update Rate
Slider@PERFTEXT_SAMPLE_AMOUNT:
X:130
Y:60
Width:250
Height:20
Ticks:5
MinimumValue: 1
MaximumValue: 50
Checkbox@CHECKUNSYNCED_CHECKBOX:
X:0
Y:90
Width:300
Height:20
Text:Check Sync around Unsynced Code Text:Check Sync around Unsynced Code
Checkbox@BOTDEBUG_CHECKBOX:
X:0
Y:120
Width:300
Height:20
Text:Show Bot Debug Messages
Label@PERFTEXT_SAMPLE_LABEL:
X:0
Y:160
Text:Slow Trait Report Threshold in (mili)seconds
Slider@LONG_TICK_THRESHOLD:
X:0
Y:170
Width:380
Height:20
Ticks:25
MinimumValue: 0.0001
MaximumValue: 0.01