Ejemplo n.º 1
0
        internal ConsoleRenderer(ConsoleInputProcessor consoleInputProcessor, ConsoleOptions options)
        {
            _consoleInputProcessor = consoleInputProcessor;
            _options = options;

            _pixel = new Texture2D(Engine.Window.GraphicsDevice, 1, 1);
            _pixel.SetData(new[] { Color.White });

            _position = new Vector2(_options.Margin, 0);

            _oneCharacterWidth = _options.Font.MeasureString("X").X;
            _maxCharactersPerLine = (int)((Bounds.Width - _options.Padding * 2) / _oneCharacterWidth);
        }
Ejemplo n.º 2
0
        public ScriptConsole(ConsoleOptions options)
        {
            if (options == null)
                throw new ArgumentNullException("options");

            Options = options;

            _consoleInputProcessor = new ConsoleInputProcessor(options);
            _consoleInputProcessor.Open += (sender, args) =>
            {
                if (Open != null)
                    Open(this, args);
            };
            _consoleInputProcessor.Close += (sender, args) =>
            {
                if (Close != null)
                    Close(this, args);
            };

            _consoleRenderer = new ConsoleRenderer(_consoleInputProcessor, options);
        }