public void SetGame(IGame game, IWindowInfo gameWindow, GameDebugTree tree) { _tree = tree; _windowInfo = gameWindow; _game = game; game.State.Viewport.PropertyChanged += onViewportPropertyChanged; setPosition(); FPSCounter fps = new FPSCounter(game, _fpsLabel); fps.Start(); MousePositionLabel mouseLabel = new MousePositionLabel(game, _mousePosLabel); mouseLabel.Start(); HotspotLabel hotspot = new HotspotLabel(game, _hotspotLabel) { DebugMode = true }; hotspot.Start(); }
private static void addDebugLabels(IGame game) { ILabel fpsLabel = game.Factory.UI.GetLabel("FPS Label", "", 30, 25, 320, 2, config: new AGSTextConfig(alignment: Alignment.TopLeft, autoFit: AutoFit.LabelShouldFitText)); fpsLabel.Pivot = new PointF(1f, 0f); fpsLabel.Scale = new PointF(0.5f, 0.5f); fpsLabel.RenderLayer = new AGSRenderLayer(-99999); fpsLabel.Enabled = true; fpsLabel.MouseEnter.Subscribe(_ => fpsLabel.Tint = Colors.Indigo); fpsLabel.MouseLeave.Subscribe(_ => fpsLabel.Tint = Colors.IndianRed.WithAlpha(125)); fpsLabel.Tint = Colors.IndianRed.WithAlpha(125); FPSCounter fps = new FPSCounter(game, fpsLabel); fps.Start(); ILabel label = game.Factory.UI.GetLabel("Mouse Position Label", "", 1, 1, 320, 17, config: new AGSTextConfig(alignment: Alignment.TopRight, autoFit: AutoFit.LabelShouldFitText)); label.Tint = Colors.SlateBlue.WithAlpha(125); label.Pivot = new PointF(1f, 0f); label.Scale = new PointF(0.5f, 0.5f); label.RenderLayer = fpsLabel.RenderLayer; MousePositionLabel mouseLabel = new MousePositionLabel(game, label); mouseLabel.Start(); ILabel debugHotspotLabel = game.Factory.UI.GetLabel("Debug Hotspot Label", "", 1f, 1f, 320, 32, config: new AGSTextConfig(alignment: Alignment.TopRight, autoFit: AutoFit.LabelShouldFitText)); debugHotspotLabel.Tint = Colors.DarkSeaGreen.WithAlpha(125); debugHotspotLabel.Pivot = new PointF(1f, 0f); debugHotspotLabel.Scale = new PointF(0.5f, 0.5f); debugHotspotLabel.RenderLayer = fpsLabel.RenderLayer; HotspotLabel hotspot = new HotspotLabel(game, debugHotspotLabel) { DebugMode = true }; hotspot.Start(); }
private void addDebugLabels(IGame game) { var resolution = new Size(1200, 800); ILabel fpsLabel = game.Factory.UI.GetLabel("FPS Label", "", 30, 25, resolution.Width, 2, config: game.Factory.Fonts.GetTextConfig(alignment: Alignment.TopLeft, autoFit: AutoFit.LabelShouldFitText)); fpsLabel.Pivot = (1f, 0f); fpsLabel.RenderLayer = new AGSRenderLayer(-99999, independentResolution: resolution); fpsLabel.Enabled = true; fpsLabel.MouseEnter.Subscribe(_ => fpsLabel.Tint = Colors.Indigo); fpsLabel.MouseLeave.Subscribe(_ => fpsLabel.Tint = Colors.IndianRed.WithAlpha(125)); fpsLabel.Tint = Colors.IndianRed.WithAlpha(125); FPSCounter fps = new FPSCounter(game, fpsLabel); fps.Start(); ILabel label = game.Factory.UI.GetLabel("Mouse Position Label", "", 1, 1, resolution.Width, 32, config: game.Factory.Fonts.GetTextConfig(alignment: Alignment.TopRight, autoFit: AutoFit.LabelShouldFitText)); label.Tint = Colors.SlateBlue.WithAlpha(125); label.Pivot = (1f, 0f); label.RenderLayer = fpsLabel.RenderLayer; MousePositionLabel mouseLabel = new MousePositionLabel(game, label); mouseLabel.Start(); ILabel debugHotspotLabel = game.Factory.UI.GetLabel("Debug Hotspot Label", "", 1f, 1f, resolution.Width, 62, config: game.Factory.Fonts.GetTextConfig(alignment: Alignment.TopRight, autoFit: AutoFit.LabelShouldFitText)); debugHotspotLabel.Tint = Colors.DarkSeaGreen.WithAlpha(125); debugHotspotLabel.Pivot = (1f, 0f); debugHotspotLabel.RenderLayer = fpsLabel.RenderLayer; HotspotLabel hotspot = new HotspotLabel(game, debugHotspotLabel) { DebugMode = true }; hotspot.Start(); }