Ejemplo n.º 1
0
        internal SadConsoleGame(string font, int consoleWidth, int consoleHeight, Action<SadConsoleGame> ctorCallback = null)
        {
            GraphicsDeviceManager = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.font = font;
            this.consoleHeight = consoleHeight;
            this.consoleWidth = consoleWidth;
            GraphicsDeviceManager.HardwareModeSwitch = false;

            ctorCallback?.Invoke(this);

            DisplayOptions = WindowResizeOptions.Scale;
        }
Ejemplo n.º 2
0
        internal SadConsoleGame(string font, int consoleWidth, int consoleHeight, Action <SadConsoleGame> ctorCallback = null)
        {
            GraphicsDeviceManager = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            this.font          = font;
            this.consoleHeight = consoleHeight;
            this.consoleWidth  = consoleWidth;
            GraphicsDeviceManager.HardwareModeSwitch = false;

            ctorCallback?.Invoke(this);


            DisplayOptions = WindowResizeOptions.Scale;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Toggles between windowed and fullscreen rendering for SadConsole.
        /// </summary>
        public static void ToggleFullScreen()
        {
            Global.GraphicsDeviceManager.ApplyChanges();

            // Coming back from fullscreen
            if (Global.GraphicsDeviceManager.IsFullScreen)
            {
                Global.GraphicsDeviceManager.IsFullScreen = !Global.GraphicsDeviceManager.IsFullScreen;

                Global.GraphicsDeviceManager.PreferredBackBufferWidth  = _preFullScreenWidth;
                Global.GraphicsDeviceManager.PreferredBackBufferHeight = _preFullScreenHeight;
                Global.GraphicsDeviceManager.ApplyChanges();
            }

            // Going full screen
            else
            {
                _preFullScreenWidth  = Global.GraphicsDevice.PresentationParameters.BackBufferWidth;
                _preFullScreenHeight = Global.GraphicsDevice.PresentationParameters.BackBufferHeight;

                if (Settings.ResizeMode == WindowResizeOptions.None)
                {
                    _handleResizeNone   = true;
                    Settings.ResizeMode = WindowResizeOptions.Scale;
                }

                Global.GraphicsDeviceManager.PreferredBackBufferWidth  = Global.GraphicsDevice.Adapter.CurrentDisplayMode.Width;
                Global.GraphicsDeviceManager.PreferredBackBufferHeight = Global.GraphicsDevice.Adapter.CurrentDisplayMode.Height;

                Global.GraphicsDeviceManager.IsFullScreen = !Global.GraphicsDeviceManager.IsFullScreen;
                Global.GraphicsDeviceManager.ApplyChanges();

                if (_handleResizeNone)
                {
                    _handleResizeNone   = false;
                    Settings.ResizeMode = WindowResizeOptions.None;
                }
            }
        }