From f2b9a9c2b0a3d7af3b56df9ae09db8a3b2d8506c Mon Sep 17 00:00:00 2001 From: emmauss Date: Thu, 6 Feb 2020 11:25:47 +0000 Subject: Render Profiler in GUI (#854) * move profiler output to gui * addressed commits, rebased * removed whitespaces --- Ryujinx.Profiler/UI/ProfileButton.cs | 110 ----------------------------------- 1 file changed, 110 deletions(-) delete mode 100644 Ryujinx.Profiler/UI/ProfileButton.cs (limited to 'Ryujinx.Profiler/UI/ProfileButton.cs') diff --git a/Ryujinx.Profiler/UI/ProfileButton.cs b/Ryujinx.Profiler/UI/ProfileButton.cs deleted file mode 100644 index 7e2ae728..00000000 --- a/Ryujinx.Profiler/UI/ProfileButton.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using OpenTK; -using OpenTK.Graphics.OpenGL; -using Ryujinx.Profiler.UI.SharpFontHelpers; - -namespace Ryujinx.Profiler.UI -{ - public class ProfileButton - { - // Store font service - private FontService _fontService; - - // Layout information - private int _left, _right; - private int _bottom, _top; - private int _height; - private int _padding; - - // Label information - private int _labelX, _labelY; - private string _label; - - // Misc - private Action _clicked; - private bool _visible; - - public ProfileButton(FontService fontService, Action clicked) - : this(fontService, clicked, 0, 0, 0, 0, 0) - { - _visible = false; - } - - public ProfileButton(FontService fontService, Action clicked, int x, int y, int padding, int height, int width) - : this(fontService, "", clicked, x, y, padding, height, width) - { - _visible = false; - } - - public ProfileButton(FontService fontService, string label, Action clicked, int x, int y, int padding, int height, int width = -1) - { - _fontService = fontService; - _clicked = clicked; - - UpdateSize(label, x, y, padding, height, width); - } - - public int UpdateSize(string label, int x, int y, int padding, int height, int width = -1) - { - _visible = true; - _label = label; - - if (width == -1) - { - // Dummy draw to measure size - width = (int)_fontService.DrawText(label, 0, 0, height, false); - } - - UpdateSize(x, y, padding, width, height); - - return _right - _left; - } - - public void UpdateSize(int x, int y, int padding, int width, int height) - { - _height = height; - _left = x; - _bottom = y; - _labelX = x + padding / 2; - _labelY = y + padding / 2; - _top = y + height + padding; - _right = x + width + padding; - } - - public void Draw() - { - if (!_visible) - { - return; - } - - // Draw backing rectangle - GL.Begin(PrimitiveType.Triangles); - GL.Color3(Color.Black); - GL.Vertex2(_left, _bottom); - GL.Vertex2(_left, _top); - GL.Vertex2(_right, _top); - - GL.Vertex2(_right, _top); - GL.Vertex2(_right, _bottom); - GL.Vertex2(_left, _bottom); - GL.End(); - - // Use font service to draw label - _fontService.DrawText(_label, _labelX, _labelY, _height); - } - - public bool ProcessClick(int x, int y) - { - // If button contains x, y - if (x > _left && x < _right && - y > _bottom && y < _top) - { - _clicked(); - return true; - } - - return false; - } - } -} -- cgit v1.2.3