void CCommandFuncs::Vid(const char* szParameters) { #if 0 // ripped from the renderware sdk CGameSettings * gameSettings = CCore::GetSingleton ( ).GetGame ( )->GetSettings(); if ( strlen(szParameters) == 0 ) { VideoMode vidModemInfo; int vidMode, numVidModes, currentVidMode; numVidModes = gameSettings->GetNumVideoModes(); currentVidMode = gameSettings->GetCurrentVideoMode(); // Add the available video modes to the dialog for (vidMode = 0; vidMode < numVidModes; vidMode++) { gameSettings->GetVideoModeInfo(&vidModemInfo, vidMode); SString strMode ( "%d: %lu x %lu x %lu %s %s", vidMode, vidModemInfo.width, vidModemInfo.height, vidModemInfo.depth, vidModemInfo.flags & rwVIDEOMODEEXCLUSIVE ? "(Fullscreen)" : "", currentVidMode == vidMode ? "(Current)" : "" ); CCore::GetSingleton ().GetConsole ()->Printf ( strMode ); } CCore::GetSingleton ().GetConsole ()->Printf( "* Syntax: vid <mode>" ); } else { // Make sure no mod is loaded if ( !CCore::GetSingleton ().GetModManager ()->IsLoaded () ) { // Grab the device window and what mode to switch to int iParameter = atoi ( szParameters ); // Change the video mode GetVideoModeManager ()->ChangeVideoMode ( iParameter ); // Grab viewport settings int iViewportX = CCore::GetSingleton ().GetGraphics()->GetViewportWidth (); int iViewportY = CCore::GetSingleton ().GetGraphics()->GetViewportHeight (); // Re-create all CGUI windows, for correct absolute sizes that depend on the (new) screen resolution CCore::GetSingleton ().GetLocalGUI ()->DestroyWindows (); CCore::GetSingleton ().GetGUI ()->SetResolution ( (float) iViewportX, (float) iViewportY ); CCore::GetSingleton ().GetLocalGUI ()->CreateWindows (); // Reload console, serverbrowser and chat settings (removed in DestroyWindows) g_pCore->ApplyConsoleSettings (); g_pCore->ApplyMenuSettings (); } else { g_pCore->GetConsole ()->Echo ( "vid: Please disconnect before changing video mode" ); } } #endif }
/////////////////////////////////////////////////////////////// // // CVideoModeManager::SetVideoMode // // Returns true if restart is required // /////////////////////////////////////////////////////////////// bool CVideoModeManager::SetVideoMode ( int iNextVideoMode, bool bNextWindowed, bool bNextFullScreenMinimize, int iNextFullscreenStyle ) { bool bRequiresRestart = false; // Resolution if ( iNextVideoMode > 0 && iNextVideoMode < (int)m_pGameSettings->GetNumVideoModes () ) { if ( m_iNextVideoMode != iNextVideoMode ) { m_iNextVideoMode = iNextVideoMode; if ( m_iCurrentVideoMode != iNextVideoMode ) { bRequiresRestart = true; } } } // Windowed if ( m_bNextWindowed != bNextWindowed ) { m_bNextWindowed = bNextWindowed; if ( m_bCurrentWindowed != bNextWindowed ) { bRequiresRestart = true; } } // Full Screen Minimize m_bCurrentFullScreenMinimize = bNextFullScreenMinimize; // Fullscreen style if ( m_iNextFullscreenStyle != iNextFullscreenStyle ) { m_iNextFullscreenStyle = iNextFullscreenStyle; if ( m_iCurrentFullscreenStyle != m_iNextFullscreenStyle ) { if ( m_iCurrentFullscreenStyle == FULLSCREEN_STANDARD || m_iNextFullscreenStyle == FULLSCREEN_STANDARD ) { bRequiresRestart = true; } else { m_iCurrentFullscreenStyle = m_iNextFullscreenStyle; } } } SaveCVars (); return bRequiresRestart; }