Пример #1
0
        private static void RenderAutoComplete()
        {
            if (_suggestions.Count > 0)
            {
                var longestSuggestion = (from command in _suggestions
                                         orderby command.Length descending
                                         select command).First();

                var size = FontManager.MeasureString(longestSuggestion);

                var x = _inputBoxRight;
                var y = _inputBoxBottom - 2;

                var lines = Math.Min(_suggestions.Count, 20);
                var h     = (lines * 16) + 4 + 6;
                var w     = size + 4 + 6;

                Renderer2D.FillRectangle(new Color(0x44, 0x44, 0x44), x, y, w, h);
                Renderer2D.DrawRectangle(new Color(0x22, 0x22, 0x22), x, y, w, h);

                foreach (var line in _suggestions)
                {
                    FontManager.SetColor(Color.White);
                    FontManager.PrintString(new Vector2(x + 5, y + 5), line);

                    y += 16;
                }
            }
        }
Пример #2
0
        private static void RenderOutputBox()
        {
            int x = 15;
            int y = _inputBoxBottom + 5;

            int w = _screenX - 30;
            int h = _screenY - y - 15 - 2;

            var size = 16;

            Renderer2D.FillRectangle(new Color(0x44, 0x44, 0x44, 0xcc), x, y, w + 2, h + 2);
            Renderer2D.DrawRectangle(new Color(0x22, 0x22, 0x22, 0xcc), x, y, w + 2, h + 2);

            bool reset = false;

            if (_screenSize == 0)
            {
                reset = true;
            }

            _screenSize = (h - 4) / 16;

            if (reset)
            {
                ResetTop();
            }

            var list = _screenBuffer.Skip(_screenTop);
            int i    = 0;

            y += 5;

            foreach (var line in list)
            {
                FontManager.SetColor(Color.White);
                FontManager.PrintString(new Vector2(x + 5, y), line);

                y += size;
                i++;

                if (i >= _screenSize)
                {
                    break;
                }
            }
        }
Пример #3
0
        private static void RenderInputBox()
        {
            var text  = "GBH2>^7 " + _inputBuffer;
            var tSize = FontManager.MeasureString(text);

            int x = 15;
            int y = 15;

            int w = _screenX - 30;
            int h = 16 + 3 + 3;

            Renderer2D.FillRectangle(new Color(0x44, 0x44, 0x44), x, y, w + 2, h + 2);
            Renderer2D.DrawRectangle(new Color(0x22, 0x22, 0x22), x, y, w + 2, h + 2);

            FontManager.SetColor(Color.Yellow);
            FontManager.PrintString(new Vector2(x + 7, y + 3), text);

            _inputBoxRight  = x + 7 + tSize;
            _inputBoxBottom = y + h + 2;
        }