Esempio n. 1
0
        public static void Print(FontInstance font, int x, int y, string text)
        {
            Graphics.SpriteBatch sb = new Gk3Main.Graphics.SpriteBatch();
            sb.Begin();

            Print(sb, font, x, y, text);

            sb.End();
        }
Esempio n. 2
0
        public static void Render(Gk3Main.Graphics.SpriteBatch spriteBatch)
        {
            if (_visible)
            {
                spriteBatch.Begin();

                // draw a background
                {
                    var renderer = Gk3Main.Graphics.RendererManager.CurrentRenderer;
                    var bg       = Gk3Main.Graphics.RendererManager.CurrentRenderer.DefaultTexture;
                    var r        = new Gk3Main.Graphics.Rect(0, 0, renderer.Viewport.Width, (_numVisibleLines + 1) * _font.Font.LineHeight);
                    spriteBatch.Draw(bg, r, null, new Gk3Main.Graphics.Color(0, 0, 0, 0.7f), 0);
                }

                int startLine = Math.Max(0, _lines.Count - _numVisibleLines);

                int cursorY = 0;
                for (int i = startLine; i < _lines.Count; i++)
                {
                    Gk3Main.Graphics.Color color;
                    if (_lines[i].Severity == Gk3Main.ConsoleSeverity.Error)
                    {
                        color = Gk3Main.Graphics.Color.Red;
                    }
                    else if (_lines[i].Severity == Gk3Main.ConsoleSeverity.Warning)
                    {
                        color = Gk3Main.Graphics.Color.Orange;
                    }
                    else
                    {
                        color = Gk3Main.Graphics.Color.White;
                    }

                    var f = _font;
                    f.Color = color;
                    Gk3Main.Gui.Font.Print(spriteBatch, f, 0, cursorY, _lines[i].Text);

                    cursorY += _font.Font.LineHeight;
                }

                Gk3Main.Gui.Font.Print(spriteBatch, _font, 0, cursorY, _command.ToString());

                spriteBatch.End();
            }
        }