public ConsoleApp(int width = 40, int height = 30) { var styles = MyConsole.WindowStyles; bool maximized = styles.HasFlag(WindowStyles.WS_MAXIMIZE) && styles.HasFlag(WindowStyles.WS_OVERLAPPEDWINDOW); bool fullscreen = styles.HasFlag(WindowStyles.WS_POPUP); int initialBufferHeight = MyConsole.GetConsoleBufferSize().Y; width = Math.Min(width, MyConsole.MaximumWidth); height = Math.Min(height, MyConsole.MaximumHeight); MyConsole.SetSize(width, height); MyConsole.Start(); if (fullscreen) { MyConsole.SetBufferSize(MyConsole.MaximumWidth, MyConsole.MaximumHeight + 1); //MyConsole.SetWindowSize(MyConsole.MaximumWidth - 1, MyConsole.MaximumHeight - 1); MyConsole.SetSize(MyConsole.MaximumWidth, MyConsole.MaximumHeight); } else if (maximized) { MyConsole.SetBufferSize(MyConsole.MaximumWidth, initialBufferHeight + 1); //MyConsole.SetWindowSize(MyConsole.MaximumWidth - 1, initialBufferHeight - 1); MyConsole.SetSize(MyConsole.MaximumWidth, initialBufferHeight); } else { MyConsole.SetSize(width, height); } }
//DrawingContext context; public void Strap(App app) { this.app = app; //context = new DrawingContext(app.width, app.height); MyConsole.SetFontSize(8, 8); MyConsole.SetSize(app.width, app.height); MyConsole.SetMode(ConsoleModes.ENABLE_EXTENDED_FLAGS | ConsoleModes.ENABLE_WINDOW_INPUT | ConsoleModes.ENABLE_MOUSE_INPUT); MyConsole.DisableResize(); app.Initialize(this); }