Ejemplo n.º 1
0
        // Wraps the calls to the GUIFont.  This provides opportunity to shadow the text if requested.
        public void DrawText(float xpos, float ypos, string label, int width)
        {
            long c = _textColor;

            if (Dimmed)
            {
                c &= DimColor;
            }
            c = GUIGraphicsContext.MergeAlpha((uint)c);

            if (Shadow)
            {
                long sc = _shadowColor;
                if (Dimmed)
                {
                    sc &= DimColor;
                }
                sc = GUIGraphicsContext.MergeAlpha((uint)sc);
                _font.DrawShadowText(xpos, ypos, c, label, Alignment.ALIGN_LEFT, width, _shadowAngle, _shadowDistance, sc);
            }
            else
            {
                var clipRect = new Rectangle();
                clipRect.X      = (int)xpos;
                clipRect.Y      = (int)ypos;
                clipRect.Width  = width > 0 ? width : GUIGraphicsContext.Width - clipRect.X;
                clipRect.Height = GUIGraphicsContext.Height - clipRect.Y;

                GUIGraphicsContext.BeginClip(clipRect);
                _font.DrawTextEx(xpos, ypos, c, label, ref _context, width);
                GUIGraphicsContext.EndClip();
            }
        }
Ejemplo n.º 2
0
        // Wraps the calls to the GUIFont.  This provides opportunity to shadow the text if requested.
        public void DrawText(float xpos, float ypos, string label, int width)
        {
            long c = (uint)_textColor;

            if (Dimmed)
            {
                c &= (DimColor);
            }
            c = GUIGraphicsContext.MergeAlpha((uint)c);

            if (Shadow)
            {
                long sc = (uint)_shadowColor;
                if (Dimmed)
                {
                    sc &= (DimColor);
                }
                sc = GUIGraphicsContext.MergeAlpha((uint)sc);

                _font.DrawShadowText(xpos, ypos, c, label, Alignment.ALIGN_LEFT, width, _shadowAngle, _shadowDistance, sc);
            }
            else
            {
                _font.DrawTextEx(xpos, ypos, c, label, ref _context, width);
            }
        }