public override void Render(float delta, float mouseX, float mouseY)
        {
            GL.Color4(Color);

            if (Font == "squareo")
            {
                fr = EditorWindow.Instance.SquareOFontRenderer;
            }
            else if (Font == "square")
            {
                fr = EditorWindow.Instance.SquareFontRenderer;
            }
            else if (Font == "main")
            {
                fr = EditorWindow.Instance.FontRenderer;
            }

            if (Timings)
            {
                fr = TimingPoints.Instance.FontRenderer;
            }

            if (Centered)
            {
                var w = fr.GetWidth(Text, FontSize);
                var h = fr.GetHeight(FontSize);

                fr.Render(Text, (int)(ClientRectangle.X - w / 2f), (int)(ClientRectangle.Y - h / 2f), FontSize);
            }
            else
            {
                fr.Render(Text, (int)ClientRectangle.X, (int)ClientRectangle.Y, FontSize);
            }
        }
Exemplo n.º 2
0
        public override void Render(float delta, float mouseX, float mouseY)
        {
            var IsMouseOverr = ClientRectangle.Contains(mouseX, mouseY);

            if (IsMouseOver && !IsMouseOverr)
            {
                OnMouseLeave(mouseX, mouseY);
            }
            else if (!IsMouseOver && IsMouseOverr)
            {
                OnMouseEnter(mouseX, mouseY);
            }
            IsMouseOver = IsMouseOverr;

            _alpha = MathHelper.Clamp(_alpha + (IsMouseOver ? 10 : -10) * delta, 0, 1);

            if (Texture > 0)
            {
                if (IsMouseOver)
                {
                    GL.Color3(0.75f, 0.75f, 0.75f);
                }
                else
                {
                    GL.Color3(1f, 1, 1);
                }

                Glu.RenderTexturedQuad(ClientRectangle, 0, 0, 1, 1, Texture);
            }
            else
            {
                if (Alpha != 0)
                {
                    if (IsMouseOver)
                    {
                        GL.Color4(Color.FromArgb(130, 0, 0, 0));
                    }
                    else
                    {
                        GL.Color4(Color.FromArgb(Alpha, 0, 0, 0));
                    }

                    Glu.RenderQuad(ClientRectangle);

                    GL.Color4(Color.FromArgb(Alpha, 0, 0, 0));
                    Glu.RenderOutline(ClientRectangle);
                }
                else
                {
                    var d = 0.075f * _alpha;

                    GL.Color3(0.1f + d, 0.1f + d, 0.1f + d);
                    Glu.RenderQuad(ClientRectangle);

                    GL.Color3(0.2f + d, 0.2f + d, 0.2f + d);
                    Glu.RenderOutline(ClientRectangle);
                }
            }

            if (Font == "squareo")
            {
                fr = EditorWindow.Instance.SquareOFontRenderer;
            }
            else if (Font == "square")
            {
                fr = EditorWindow.Instance.SquareFontRenderer;
            }
            else if (Font == "main")
            {
                fr = EditorWindow.Instance.FontRenderer;
            }

            var width  = fr.GetWidth(Text, (int)ClientRectangle.Height / 2);
            var height = fr.GetHeight((int)ClientRectangle.Height / 2);

            GL.Color3(color1, color2, color3);
            if (!Timings)
            {
                fr.Render(Text, (int)(ClientRectangle.X + ClientRectangle.Width / 2 - width / 2f), (int)(ClientRectangle.Y + ClientRectangle.Height / 2 - height / 2f), (int)ClientRectangle.Height / 2);
            }
            else
            {
                TimingPoints.Instance.FontRenderer.Render(Text, (int)(ClientRectangle.X + ClientRectangle.Width / 2 - width / 2f), (int)(ClientRectangle.Y + ClientRectangle.Height / 2 - height / 2f), (int)ClientRectangle.Height / 2);
            }
        }