Exemple #1
0
        public void Resize(Rectangle ScreenPosition, int FontScale)
        {
            int width  = ScreenPosition.Width / (6 * FontScale);
            int height = ScreenPosition.Height / (8 * FontScale);

            var rowSize    = ScreenPosition.Height / height;
            var realHeight = height * rowSize;
            var colSize    = ScreenPosition.Width / width;
            var realWidth  = width * colSize;

            ActualDrawSize = new Rectangle(
                ScreenPosition.X + ((ScreenPosition.Width - realWidth) / 2),
                ScreenPosition.Y + ((ScreenPosition.Height - realHeight) / 2),
                realWidth,
                realHeight);

            Display      = new ConsoleDisplay(width, height, font, Graphics, Content);
            Buffer       = new DynamicConsoleBuffer(2048, Display);
            InputHandler = new ConsoleInputHandler(ConsoleCommandHandler, Buffer, width);

            this.ScreenPosition  = ScreenPosition;
            ConsoleRenderSurface = new RenderTarget2D(Graphics, width * font.glyphWidth, height * font.glyphHeight, false,
                                                      SurfaceFormat.Color, DepthFormat.Depth16);
        }
Exemple #2
0
        public void Resize(Rectangle ScreenPosition, int FontScale)
        {
            int width = ScreenPosition.Width / (6 * FontScale);
            int height = ScreenPosition.Height / (8 * FontScale);

            var rowSize = ScreenPosition.Height / height;
            var realHeight = height * rowSize;
            var colSize = ScreenPosition.Width / width;
            var realWidth = width * colSize;

            ActualDrawSize = new Rectangle(
                ScreenPosition.X + ((ScreenPosition.Width - realWidth) / 2),
                ScreenPosition.Y + ((ScreenPosition.Height - realHeight) / 2),
                realWidth,
                realHeight);

            Display = new ConsoleDisplay(width, height, font, Graphics, Content);
            Buffer = new DynamicConsoleBuffer(2048, Display);
            InputHandler = new ConsoleInputHandler(ConsoleCommandHandler, Buffer, width);

            this.ScreenPosition = ScreenPosition;
            ConsoleRenderSurface = new RenderTarget2D(Graphics, width * font.glyphWidth, height * font.glyphHeight, false,
                SurfaceFormat.Color, DepthFormat.Depth16);
        }