diff --git a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj index ac48cabe2f..333ec49300 100644 --- a/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj +++ b/OpenRA.Mods.Cnc/OpenRA.Mods.Cnc.csproj @@ -97,7 +97,6 @@ - diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs deleted file mode 100644 index 3d04cae420..0000000000 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncPerfDebugLogic.cs +++ /dev/null @@ -1,33 +0,0 @@ -#region Copyright & License Information -/* - * Copyright 2007-2011 The OpenRA Developers (see AUTHORS) - * This file is part of OpenRA, which is free software. It is made - * available to you under the terms of the GNU General Public License - * as published by the Free Software Foundation. For more information, - * see COPYING. - */ -#endregion - -using OpenRA.Support; -using OpenRA.Widgets; - -namespace OpenRA.Mods.Cnc.Widgets.Logic -{ - public class CncPerfDebugLogic - { - [ObjectCreator.UseCtor] - public CncPerfDebugLogic(Widget widget) - { - // Performance info - var perfRoot = widget.Get("PERFORMANCE_INFO"); - perfRoot.IsVisible = () => Game.Settings.Debug.PerfGraph; - var text = perfRoot.Get("PERF_TEXT"); - text.IsVisible = () => Game.Settings.Debug.PerfText; - text.GetText = () => - "Tick {0} @ {1:F1} ms\nRender {2} @ {3:F1} ms\nBatches: {4}".F( - Game.LocalTick, PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples), - Game.RenderFrame, PerfHistory.items["render"].Average(Game.Settings.Debug.Samples), - PerfHistory.items["batches"].LastValue); - } - } -} diff --git a/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs index 51ac053e50..540e769f2e 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/MainMenuButtonsLogic.cs @@ -25,7 +25,6 @@ namespace OpenRA.Mods.RA.Widgets.Logic rootMenu = widget; rootMenu.IsVisible = () => Menu == MenuType.Main; - Game.modData.WidgetLoader.LoadWidget( new WidgetArgs(), Ui.Root, "PERF_BG" ); var versionLabel = Ui.Root.GetOrNull("VERSION_LABEL"); if (versionLabel != null) versionLabel.GetText = WidgetUtils.ActiveModVersion; diff --git a/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs b/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs index 3edc0e88e0..da6f47a7c4 100644 --- a/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs +++ b/OpenRA.Mods.RA/Widgets/Logic/PerfDebugLogic.cs @@ -15,21 +15,18 @@ namespace OpenRA.Mods.RA.Widgets.Logic { public class PerfDebugLogic { - public PerfDebugLogic() + [ObjectCreator.UseCtor] + public PerfDebugLogic(Widget widget) { - var r = Ui.Root; - var perfRoot = r.Get("PERF_BG"); - perfRoot.IsVisible = () => perfRoot.Visible && Game.Settings.Debug.PerfGraph; + var perfGraph = widget.Get("GRAPH_BG"); + perfGraph.IsVisible = () => Game.Settings.Debug.PerfGraph; - // Perf text - var perfText = perfRoot.Get("TEXT"); + var perfText = widget.Get("PERF_TEXT"); perfText.IsVisible = () => Game.Settings.Debug.PerfText; - perfText.GetText = () => "Render {0} ({5}={2:F1} ms)\nTick {4} ({3:F1} ms)".F( - Game.RenderFrame, - Game.NetFrameNumber, - PerfHistory.items["render"].Average(Game.Settings.Debug.Samples), - PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples), - Game.LocalTick, + perfText.GetText = () => + "Tick {0} @ {1:F1} ms\nRender {2} @ {3:F1} ms\nBatches: {4}".F( + Game.LocalTick, PerfHistory.items["tick_time"].Average(Game.Settings.Debug.Samples), + Game.RenderFrame, PerfHistory.items["render"].Average(Game.Settings.Debug.Samples), PerfHistory.items["batches"].LastValue); } } diff --git a/mods/cnc/chrome/ingame.yaml b/mods/cnc/chrome/ingame.yaml index fea02f8732..1397667cee 100644 --- a/mods/cnc/chrome/ingame.yaml +++ b/mods/cnc/chrome/ingame.yaml @@ -23,19 +23,27 @@ Container@INGAME_ROOT: Height: 30 UseContrast: yes Container@PERFORMANCE_INFO: - Logic:CncPerfDebugLogic + Logic:PerfDebugLogic Children: Label@PERF_TEXT: - X:85 - Y:10 + X:WINDOW_RIGHT - 200 + Y:WINDOW_BOTTOM - 70 Width:170 Height:40 Contrast:true - PerfGraph@GRAPH: + VAlign:Top + Background@GRAPH_BG: X:10 Y:WINDOW_BOTTOM-HEIGHT-10 - Width:200 - Height:200 + Width:220 + Height:220 + Background:panel-black + Children: + PerfGraph@GRAPH: + X:10 + Y:10 + Width:200 + Height:200 WorldInteractionController@INTERACTION_CONTROLLER: Width:WINDOW_RIGHT Height:WINDOW_BOTTOM diff --git a/mods/cnc/chrome/mainmenu.yaml b/mods/cnc/chrome/mainmenu.yaml index 2e38979737..f332b690cc 100644 --- a/mods/cnc/chrome/mainmenu.yaml +++ b/mods/cnc/chrome/mainmenu.yaml @@ -171,7 +171,7 @@ Container@MENU_BACKGROUND: Height:35 Text:Back Container@PERFORMANCE_INFO: - Logic:CncPerfDebugLogic + Logic:PerfDebugLogic Children: Label@PERF_TEXT: X:40 diff --git a/mods/ra/chrome/ingame.yaml b/mods/ra/chrome/ingame.yaml index 7fe492feff..450626e20a 100644 --- a/mods/ra/chrome/ingame.yaml +++ b/mods/ra/chrome/ingame.yaml @@ -36,25 +36,28 @@ Container@INGAME_ROOT: Text:Options (ESC) Font:Bold Key: escape - Background@PERF_BG: - ClickThrough:true - Background:dialog4 + Container@PERFORMANCE_INFO: Logic:PerfDebugLogic - X:10 - Y:WINDOW_BOTTOM - 250 - Width: 210 - Height: 250 Children: - PerfGraph@GRAPH: - X:5 - Y:5 - Width:200 - Height:200 - Label@TEXT: - X:20 - Y:205 + Label@PERF_TEXT: + X:WINDOW_RIGHT - 200 + Y:WINDOW_BOTTOM - 70 Width:170 Height:40 + Contrast:true + Background@GRAPH_BG: + ClickThrough:true + Background:dialog4 + X:30 + Y:WINDOW_BOTTOM - 240 + Width:210 + Height:210 + Children: + PerfGraph@GRAPH: + X:5 + Y:5 + Width:200 + Height:200 TooltipContainer@TOOLTIP_CONTAINER: Container@PLAYER_WIDGETS: diff --git a/mods/ra/chrome/mainmenu.yaml b/mods/ra/chrome/mainmenu.yaml index 993445a453..41d81c7956 100644 --- a/mods/ra/chrome/mainmenu.yaml +++ b/mods/ra/chrome/mainmenu.yaml @@ -104,22 +104,25 @@ Container@MAINMENU: Height:35 Text:Quit Font:Bold -Background@PERF_BG: - ClickThrough:true - Background:dialog4 - Logic:PerfDebugLogic - X:10 - Y:WINDOW_BOTTOM - 250 - Width: 210 - Height: 250 - Children: - PerfGraph@GRAPH: - X:5 - Y:5 - Width:200 - Height:200 - Label@TEXT: - X:20 - Y:205 - Width:170 - Height:40 \ No newline at end of file + Container@PERFORMANCE_INFO: + Logic:PerfDebugLogic + Children: + Label@PERF_TEXT: + X:30 + Y:WINDOW_BOTTOM - 70 + Width:170 + Height:40 + Contrast:true + Background@GRAPH_BG: + ClickThrough:true + Background:dialog4 + X:WINDOW_RIGHT - 240 + Y:WINDOW_BOTTOM - 240 + Width:210 + Height:210 + Children: + PerfGraph@GRAPH: + X:5 + Y:5 + Width:200 + Height:200 \ No newline at end of file