/// <summary> /// Create a console input handler /// </summary> /// <param name="OnCommand">Call back to invoke when ctrl+enter is pressed</param> /// <param name="Buffer">Buffer this handler will manipulate</param> /// <param name="DisplayWidth">The width of the underlying display, in characters</param> public ConsoleInputHandler( Action<String> OnCommand, DynamicConsoleBuffer Buffer, int DisplayWidth) { this.displayWidth = DisplayWidth; this.OnCommand = OnCommand; this.textBuffer = Buffer; }
public VirtualConsole( Action<String> processCommand, GraphicsDevice graphicsDevice, ContentManager contentManager) { commandHandler = processCommand; this.graphicsDevice = graphicsDevice; this.contentManager = contentManager; display = new TextDisplay(80, 25, graphicsDevice, contentManager); dynamicConsole = new DynamicConsoleBuffer(2048, display); }
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); }