Exemple #1
0
 bool handleWindowedModeHotkey(iDiligentWindow window, eKey key, eKeyboardState ks)
 {
     // if( key == eKey.Esc && content.windowState == eShowWindow.Fullscreen )
     if (key == eKey.Esc)
     {
         window.moveWindow(eShowWindow.Normal);
         return(true);
     }
     if (key == eKey.Up && ks.HasFlag(eKeyboardState.ControlDown))
     {
         window.moveWindow(eShowWindow.Maximized);
         return(true);
     }
     if (key == eKey.Down && ks.HasFlag(eKeyboardState.ControlDown))
     {
         window.moveWindow(eShowWindow.Minimized);
         return(true);
     }
     if (key == eKey.Enter && ks.HasFlag(eKeyboardState.AltDown))
     {
         if (ks.HasFlag(eKeyboardState.ControlDown))
         {
             switchToTrueFullScreen(window);
         }
         else
         {
             window.moveWindow(eShowWindow.Fullscreen);
         }
         return(true);
     }
     return(false);
 }
Exemple #2
0
        void switchToTrueFullScreen(iDiligentWindow window)
        {
            if (window.windowState == eShowWindow.TrueFullscreen)
            {
                // Already in true full screen mode. Switch to maximized borderless.
                window.moveWindow(eShowWindow.Fullscreen);
                return;
            }

            iGraphicsEngine graphicsEngine = Render.graphicsEngine;

            using (var gpuEnum = graphicsEngine.createGpuEnumerator())
                using (var gpu = gpuEnum.openDefaultAdapter())
                    using (var connector = gpu.openDefaultConnector())
                    {
                        var format = context.swapChainFormats.color;
                        if (format == Diligent.Graphics.TextureFormat.Unknown)
                        {
                            throw new ApplicationException("The swap chain was not created");
                        }
                        connector.setSurfaceFormat(format);

                        // Debug code below
                        // Console.WriteLine( "Following is available:\n{0}", string.Join( "\n", connector.getAllModes() ) );
                        // connector.enumModes();

                        CSize trueFullScreenRez = new CSize(1920, 1080);
                        if (!connector.findVideoMode(out var mode, ref trueFullScreenRez))
                        {
                            throw new ApplicationException("The default monitor doesn't support FullHD");
                        }
                        window.fullScreen(connector, ref mode);
                    }
        }
Exemple #3
0
        /// <summary>Switch window state without moving the window</summary>
        public static void moveWindow(this iDiligentWindow wnd, eShowWindow newState)
        {
            CRect rect = CRect.empty;

            wnd.moveWindow(newState, ref rect);
        }