Fix 2c9e6ac9f614 (windows + logic)

floating-point
Julius Michaelis 2012-10-03 00:54:56 +02:00
parent 023aa90c0e
commit ab880d6bd8
4 changed files with 9 additions and 5 deletions

View File

@ -81,8 +81,8 @@ public:
// set by ParseCommandLine, for manually invoking an update check by command line or url
int CheckForUpdates;
int GetConfigWidth() { return (Config.Graphics.Windowed == 2 && AppState == C4AS_Game) || Config.Graphics.Windowed ? Config.Graphics.WindowX : Config.Graphics.ResX; }
int GetConfigHeight() { return (Config.Graphics.Windowed == 2 && AppState == C4AS_Game) || Config.Graphics.Windowed ? Config.Graphics.WindowY : Config.Graphics.ResY; }
int GetConfigWidth() { return (Config.Graphics.Windowed == 2 && AppState != C4AS_Game) || Config.Graphics.Windowed == 1 ? Config.Graphics.WindowX : Config.Graphics.ResX; }
int GetConfigHeight() { return (Config.Graphics.Windowed == 2 && AppState != C4AS_Game) || Config.Graphics.Windowed == 1 ? Config.Graphics.WindowY : Config.Graphics.ResY; }
protected:
enum State { C4AS_None, C4AS_PreInit, C4AS_Startup, C4AS_StartGame, C4AS_Game, C4AS_AfterGame, C4AS_Quit } AppState;
C4ApplicationGameTimer *pGameTimer;

View File

@ -1339,6 +1339,8 @@ const char * C4StartupOptionsDlg::GetWindowedName(int32_t mode /* = -1*/)
if(mode == 0) return LoadResStr("IDS_MSG_FULLSCREEN");
else if(mode == 1) return LoadResStr("IDS_MSG_WINDOWED");
else if(mode == 2) return LoadResStr("IDS_MSG_AUTOWINDOWED");
assert(!"Requested name for config value which does not exist");
return "ERR: Unknown";
}
void C4StartupOptionsDlg::OnWindowedModeComboFill(C4GUI::ComboBox_FillCB *pFiller)
@ -1353,6 +1355,7 @@ bool C4StartupOptionsDlg::OnWindowedModeComboSelChange(C4GUI::ComboBox *pForComb
Config.Graphics.Windowed = idNewSelection;
Application.SetVideoMode(Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, !Config.Graphics.Windowed);
pForCombo->SetText(GetWindowedName(idNewSelection));
return true;
}
void C4StartupOptionsDlg::OnGfxAllResolutionsChange(C4GUI::Element *pCheckBox)

View File

@ -51,8 +51,9 @@ C4Window * C4Window::Init(WindowKind windowKind, C4AbstractApp * pApp, const cha
return NULL;
Active = true;
// SDL doesn't support multiple monitors.
if (!SDL_SetVideoMode(Config.Graphics.GetWidth() == -1 ? 0 : Config.Graphics.GetWidth(), Config.Graphics.GetHeight() == -1 ? 0 : Config.Graphics.GetHeight(),
Config.Graphics.BitDepth, SDL_OPENGL | (Config.Graphics.Windowed ? 0 : SDL_FULLSCREEN)))
if (!SDL_SetVideoMode(Application.GetConfigWidth() == -1 ? 0 : Application.GetConfigWidth(),
Application.GetConfigHeight() == -1 ? 0 : Application.GetConfigHeight(),
Config.Graphics.BitDepth, SDL_OPENGL | (Config.Graphics.Windowed ? 0 : SDL_FULLSCREEN)))
{
Log(SDL_GetError());
return 0;

View File

@ -72,7 +72,7 @@ LRESULT APIENTRY FullScreenWinProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l
if (pTexMgr) pTexMgr->IntUnlock();
if (!Config.Graphics.Windowed)
{
Application.SetVideoMode(Config.Graphics.GetWidth(), Config.Graphics.GetHeight(), Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, !Config.Graphics.Windowed);
Application.SetVideoMode(Application.GetConfigWidth(), Application.GetConfigHeight(), Config.Graphics.BitDepth, Config.Graphics.RefreshRate, Config.Graphics.Monitor, Config.Graphics.Windowed == 1);
}
}
else