public GameConsoleComponent(GameConsole console, Game game, SpriteBatch spriteBatch)
            : base(game)
        {
            this.console = console;
            this.spriteBatch = spriteBatch;
            inputProcesser = new InputProcessor(new CommandProcesser());
            inputProcesser.Open += (s, e) => renderer.Open();
            inputProcesser.Close += (s, e) => renderer.Close();

            renderer = new Renderer(game, spriteBatch, inputProcesser);
        }
Example #2
0
        public GameConsoleComponent(GameConsole console, Game game, SpriteBatch spriteBatch)
            : base(game)
        {
            this.console          = console;
            this.spriteBatch      = spriteBatch;
            inputProcesser        = new InputProcessor(new CommandProcesser());
            inputProcesser.Open  += (s, e) => renderer.Open();
            inputProcesser.Close += (s, e) => renderer.Close();

            renderer = new Renderer(game, spriteBatch, inputProcesser);
        }
Example #3
0
 public Renderer(Game game, SpriteBatch spriteBatch, InputProcessor inputProcessor)
 {
     currentState        = State.Closed;
     width               = game.GraphicsDevice.Viewport.Width;
     position            = closedPosition = new Vector2(GameConsoleOptions.Options.Margin, -GameConsoleOptions.Options.Height - GameConsoleOptions.Options.RoundedCorner.Height);
     openedPosition      = new Vector2(GameConsoleOptions.Options.Margin, 0);
     this.spriteBatch    = spriteBatch;
     this.inputProcessor = inputProcessor;
     pixel               = new Texture2D(game.GraphicsDevice, 1, 1, false, SurfaceFormat.Color);
     pixel.SetData(new[] { Color.White });
     firstCommandPositionOffset = Vector2.Zero;
     oneCharacterWidth          = GameConsoleOptions.Options.Font.MeasureString("x").X;
     maxCharactersPerLine       = (int)((Bounds.Width - GameConsoleOptions.Options.Padding * 2) / oneCharacterWidth);
 }
Example #4
0
 public Renderer(Game game, SpriteBatch spriteBatch, InputProcessor inputProcessor)
 {
     currentState = State.Closed;
     width = game.GraphicsDevice.Viewport.Width;
     position = closedPosition = new Vector2(GameConsoleOptions.Options.Margin, -GameConsoleOptions.Options.Height - GameConsoleOptions.Options.RoundedCorner.Height);
     openedPosition = new Vector2(GameConsoleOptions.Options.Margin, 0);
     this.spriteBatch = spriteBatch;
     this.inputProcessor = inputProcessor;
     pixel = new Texture2D(game.GraphicsDevice, 1, 1,false, SurfaceFormat.Color);
     pixel.SetData(new[] { Color.White });
     firstCommandPositionOffset = Vector2.Zero;
     oneCharacterWidth = GameConsoleOptions.Options.Font.MeasureString("x").X;
     maxCharactersPerLine = (int)((Bounds.Width - GameConsoleOptions.Options.Padding * 2) / oneCharacterWidth);
 }