예제 #1
0
        public void Render(GL gl)
        {
            gl.Begin(PrimitiveType.Lines);
            if (_selected)
            {
                gl.Color4(0.0f, 1.0f, 0.0f, 1.0f);
            }
            else
            {
                gl.Color4(0.0f, 0.0f, 0.0f, 1.0f);
            }
            gl.Vertex2(_x, _y);
            gl.Vertex2(_x + _width, _y);
            gl.Vertex2(_x, _y);
            gl.Vertex2(_x, _y + _height);
            gl.Vertex2(_x + _width, _y);
            gl.Vertex2(_x + _width, _y + _height);
            gl.Vertex2(_x, _y + _height);
            gl.Vertex2(_x + _width, _y + _height);
            gl.End();

            _fons.SetFont(_fons.GetFontByName(_font));
            _fons.SetSize((float)_fontSize);
            _fons.SetColour(0xFF000000);
            _fons.DrawText(_x + 1.0f, _y + _height - 3.0f, _name + ": " + _text);
        }
예제 #2
0
        /// <summary>
        /// Finds a loaded font from specified name.
        /// </summary>
        /// <returns>Handle to it, or -1 if the font is not found.</returns>
        public static int FindFont(this Nvg nvg, string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(-1);
            }

            Fontstash fons = nvg.fontManager.Fontstash;

            return(fons.GetFontByName(name));
        }
예제 #3
0
        public void Render(Fontstash fons)
        {
            if (_active)
            {
                fons.SetColour(0xFF00FFFF);
            }
            else
            {
                fons.SetColour(0xFF000000);
            }

            fons.SetFont(fons.GetFontByName("stdfont"));
            fons.SetSize(18.0f);
            fons.DrawText(_x + 2.0f, _y + _height, _active ? _activeText : _text);
        }
예제 #4
0
        public void Render(LevelSelectorStateRenderer renderer, Fontstash fons)
        {
            renderer.RenderQuad(_button.X, _button.Y, _button.Width, _button.Height, new Vector4(_colour, Hovering ? 1.0f : 0.75f));

            float size = 32;
            float x    = _button.X + size / 1.5f;
            float y    = _button.Y + size * 1.5f;

            for (int i = 0; i < _data.bestRating; i++)
            {
                renderer.RenderTexturedQuad(_state.Star, x + i * size, y, size, -size);
            }

            renderer.PrepareLegacy();
            fons.SetColour(0xFFFFFFFF);
            fons.SetFont(fons.GetFontByName("stdfont"));
            fons.SetSize(24.0f);
            fons.SetAlign((int)FonsAlign.Center | (int)FonsAlign.Middle);
            fons.DrawText(_button.X + _button.Width / 2.0f, _button.Y + _button.Height / 2.0f, _data.name);
            fons.SetSize(16.0f);
            fons.DrawText(_button.X + _button.Width / 2.0f, _button.Y + _button.Height / 2.0f + 35.0f, "Last Time: " + _data.bestTime.ToString());
            renderer.EndLegacy();
        }
예제 #5
0
        /// <summary>
        /// Sets the font face based on specified name of current text style.
        /// </summary>
        public static void FontFace(this Nvg nvg, string font)
        {
            Fontstash fons = nvg.fontManager.Fontstash;

            nvg.stateStack.CurrentState.FontId = fons.GetFontByName(font);
        }