Only restart game on Display changes that require it
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7822 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 763db90c0f42b24de8ae13d70c43de975e37699f Former-commit-id: 36da23a4517bcddf48edb01a257c34ed375d26d4
This commit is contained in:
parent
1d565368aa
commit
af43367789
2 changed files with 28 additions and 8 deletions
|
@ -167,11 +167,24 @@ void DisplayMenu::onAccept(void *pDisplayMenu)
|
||||||
// Save some settings to graph.xml
|
// Save some settings to graph.xml
|
||||||
pMenu->storeGraphicSettings();
|
pMenu->storeGraphicSettings();
|
||||||
|
|
||||||
// Shutdown the user interface.
|
if(pMenu->restartNeeded())
|
||||||
LegacyMenu::self().shutdown();
|
{
|
||||||
|
// Shutdown the user interface.
|
||||||
|
LegacyMenu::self().shutdown();
|
||||||
|
|
||||||
// Restart the game.
|
// Restart the game.
|
||||||
GfuiApp().restart();
|
GfuiApp().restart();
|
||||||
|
}
|
||||||
|
GfuiScreenActivate(pMenu->getPreviousMenuHandle());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DisplayMenu::restartNeeded()
|
||||||
|
{
|
||||||
|
bool needRestart = ((_eDisplayMode != _eOriginalDisplayMode)
|
||||||
|
|| (_nScreenWidth !=_nOriginalScreenWidth)
|
||||||
|
|| (_nScreenHeight != _nOriginalScreenHeight));
|
||||||
|
|
||||||
|
return needRestart;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayMenu::onCancel(void *pDisplayMenu)
|
void DisplayMenu::onCancel(void *pDisplayMenu)
|
||||||
|
@ -235,11 +248,11 @@ void DisplayMenu::loadSettings()
|
||||||
// Display mode : Full-screen or Windowed.
|
// Display mode : Full-screen or Windowed.
|
||||||
const char *pszFullScreen =
|
const char *pszFullScreen =
|
||||||
GfParmGetStr(hScrConfParams, pszScrPropSec, GFSCR_ATT_FSCR, GFSCR_VAL_NO);
|
GfParmGetStr(hScrConfParams, pszScrPropSec, GFSCR_ATT_FSCR, GFSCR_VAL_NO);
|
||||||
_eDisplayMode = strcmp(pszFullScreen, GFSCR_VAL_YES) ? eWindowed : eFullScreen;
|
_eOriginalDisplayMode = _eDisplayMode = strcmp(pszFullScreen, GFSCR_VAL_YES) ? eWindowed : eFullScreen;
|
||||||
|
|
||||||
// Screen / window size.
|
// Screen / window size.
|
||||||
_nScreenWidth = (int)GfParmGetNum(hScrConfParams, pszScrPropSec, GFSCR_ATT_WIN_X, NULL, 800);
|
_nOriginalScreenWidth =_nScreenWidth = (int)GfParmGetNum(hScrConfParams, pszScrPropSec, GFSCR_ATT_WIN_X, NULL, 800);
|
||||||
_nScreenHeight = (int)GfParmGetNum(hScrConfParams, pszScrPropSec, GFSCR_ATT_WIN_Y, NULL, 600);
|
_nOriginalScreenHeight = _nScreenHeight = (int)GfParmGetNum(hScrConfParams, pszScrPropSec, GFSCR_ATT_WIN_Y, NULL, 600);
|
||||||
|
|
||||||
#ifndef NoMaxRefreshRate
|
#ifndef NoMaxRefreshRate
|
||||||
// Max. refresh rate (Hz).
|
// Max. refresh rate (Hz).
|
||||||
|
@ -486,10 +499,12 @@ DisplayMenu::DisplayMenu()
|
||||||
_fArcRatio = 1.0f;
|
_fArcRatio = 1.0f;
|
||||||
_fBezelComp = 110.0f;
|
_fBezelComp = 110.0f;
|
||||||
_fScreenDist = 1.0f;
|
_fScreenDist = 1.0f;
|
||||||
|
_nOriginalScreenWidth = 800;
|
||||||
|
_nOriginalScreenHeight = 600;
|
||||||
|
_eOriginalDisplayMode = eWindowed;
|
||||||
#ifndef NoMaxRefreshRate
|
#ifndef NoMaxRefreshRate
|
||||||
_nMaxRefreshRate = 0;
|
_nMaxRefreshRate = 0;
|
||||||
#endif
|
#endif
|
||||||
printf("this = %p \n", this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayMenu::~DisplayMenu()
|
DisplayMenu::~DisplayMenu()
|
||||||
|
|
|
@ -62,6 +62,8 @@ protected:
|
||||||
void resetColorDepths();
|
void resetColorDepths();
|
||||||
void resetScreenSizes();
|
void resetScreenSizes();
|
||||||
|
|
||||||
|
bool restartNeeded();
|
||||||
|
|
||||||
// Control callback functions (must be static).
|
// Control callback functions (must be static).
|
||||||
static void onActivate(void *pDisplayMenu);
|
static void onActivate(void *pDisplayMenu);
|
||||||
static void onChangeScreenSize(tComboBoxInfo *pInfo);
|
static void onChangeScreenSize(tComboBoxInfo *pInfo);
|
||||||
|
@ -86,10 +88,13 @@ private:
|
||||||
|
|
||||||
//! Currently selected display mode.
|
//! Currently selected display mode.
|
||||||
EDisplayMode _eDisplayMode;
|
EDisplayMode _eDisplayMode;
|
||||||
|
EDisplayMode _eOriginalDisplayMode;
|
||||||
|
|
||||||
//! Currently selected screen size.
|
//! Currently selected screen size.
|
||||||
int _nScreenWidth;
|
int _nScreenWidth;
|
||||||
int _nScreenHeight;
|
int _nScreenHeight;
|
||||||
|
int _nOriginalScreenWidth;
|
||||||
|
int _nOriginalScreenHeight;
|
||||||
|
|
||||||
EDisplayType _eDisplayType;
|
EDisplayType _eDisplayType;
|
||||||
float _fArcRatio;
|
float _fArcRatio;
|
||||||
|
|
Loading…
Reference in a new issue