Exemple #1
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);
     openedPosition = new Vector2(GameConsoleOptions.Options.Margin, 0);
     this.spriteBatch = spriteBatch;
     this.inputProcessor = inputProcessor;
     pixel = new Texture2D(game.GraphicsDevice, 1, 1);
     pixel.SetData(new[] { Color.White });
     firstCommandPositionOffset = Vector2.Zero;
     oneCharacterWidth = GameConsoleOptions.Options.Font.MeasureString("x").X;
     maxCharactersPerLine = (int)((Bounds.Width - GameConsoleOptions.Options.Padding * 2) / oneCharacterWidth);
 }
Exemple #2
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);
     openedPosition      = new Vector2(GameConsoleOptions.Options.Margin, 0);
     this.spriteBatch    = spriteBatch;
     this.inputProcessor = inputProcessor;
     pixel               = new Texture2D(game.GraphicsDevice, 1, 1);
     pixel.SetData(new[] { Color.White });
     firstCommandPositionOffset = Vector2.Zero;
     oneCharacterWidth          = GameConsoleOptions.Options.Font.MeasureString("x").X;
     maxCharactersPerLine       = (int)((Bounds.Width - GameConsoleOptions.Options.Padding * 2) / oneCharacterWidth);
 }
Exemple #3
0
        public GameConsoleComponent(GameConsole console, Game game, SpriteBatch spriteBatch) : base(game)
        {
            this.console     = console;
            this.spriteBatch = spriteBatch;

            inputProcesser = new InputProcessor(new CommandProcesser(), game.Window);

            inputProcesser.Open  += (s, e) => renderer.Open();
            inputProcesser.Close += (s, e) => renderer.Close();

            renderer = new Renderer(game, spriteBatch, inputProcesser);
            var inbuiltCommands = new IConsoleCommand[] { new ClearScreenCommand(inputProcesser), new ExitCommand(game), new HelpCommand() };

            GameConsoleOptions.Commands.AddRange(inbuiltCommands);
        }
        public GameConsoleComponent(GameConsole console, Game game, SpriteBatch spriteBatch)
            : base(game)
        {
            this.console = console;
            this.spriteBatch = spriteBatch;

            inputProcesser = new InputProcessor(new CommandProcesser(), game.Window);

            inputProcesser.Open += (s, e) => renderer.Open();
            inputProcesser.Close += (s, e) => renderer.Close();

            renderer = new Renderer(game, spriteBatch, inputProcesser);
            var inbuiltCommands = new IConsoleCommand[] { new ClearScreenCommand(inputProcesser), new ExitCommand(game), new HelpCommand() };
            GameConsoleOptions.Commands.AddRange(inbuiltCommands);
        }