Commit 0687e441 authored by mercury233's avatar mercury233

remember window size

parent 1b117f0e
......@@ -29,7 +29,7 @@ bool Game::Initialize() {
params.DriverType = irr::video::EDT_DIRECT3D9;
else
params.DriverType = irr::video::EDT_OPENGL;
params.WindowSize = irr::core::dimension2d<u32>(1024, 640);
params.WindowSize = irr::core::dimension2d<u32>(gameConf.window_width, gameConf.window_height);
device = irr::createDeviceEx(params);
if(!device)
return false;
......@@ -70,6 +70,8 @@ bool Game::Initialize() {
smgr = device->getSceneManager();
device->setWindowCaption(L"YGOPro");
device->setResizable(true);
if(gameConf.window_maximized)
device->maximizeWindow();
#ifdef _WIN32
irr::video::SExposedVideoData exposedData = driver->getExposedVideoData();
if(gameConf.use_d3d)
......@@ -1009,6 +1011,9 @@ void Game::LoadConfig() {
gameConf.chkIgnoreDeckChanges = 0;
gameConf.defaultOT = 1;
gameConf.enable_bot_mode = 0;
gameConf.window_maximized = false;
gameConf.window_width = 1024;
gameConf.window_height = 640;
while(fgets(linebuf, 256, fp)) {
sscanf(linebuf, "%s = %s", strbuf, valbuf);
if(!strcmp(strbuf, "antialias")) {
......@@ -1071,6 +1076,12 @@ void Game::LoadConfig() {
gameConf.defaultOT = atoi(valbuf);
} else if(!strcmp(strbuf, "enable_bot_mode")) {
gameConf.enable_bot_mode = atoi(valbuf);
} else if(!strcmp(strbuf, "window_maximized")) {
gameConf.window_maximized = atoi(valbuf) > 0;
} else if(!strcmp(strbuf, "window_width")) {
gameConf.window_width = atoi(valbuf);
} else if(!strcmp(strbuf, "window_height")) {
gameConf.window_height = atoi(valbuf);
} else {
// options allowing multiple words
sscanf(linebuf, "%s = %240[^\n]", strbuf, valbuf);
......@@ -1131,6 +1142,9 @@ void Game::SaveConfig() {
fprintf(fp, "ignore_deck_changes = %d\n", (chkIgnoreDeckChanges->isChecked() ? 1 : 0));
fprintf(fp, "default_ot = %d\n", gameConf.defaultOT);
fprintf(fp, "enable_bot_mode = %d\n", gameConf.enable_bot_mode);
fprintf(fp, "window_maximized = %d\n", (gameConf.window_maximized ? 1 : 0));
fprintf(fp, "window_width = %d\n", gameConf.window_width);
fprintf(fp, "window_height = %d\n", gameConf.window_height);
fclose(fp);
}
void Game::ShowCardInfo(int code) {
......@@ -1329,6 +1343,17 @@ const wchar_t* Game::LocalName(int local_player) {
return local_player == 0 ? dInfo.hostname : dInfo.clientname;
}
void Game::OnResize() {
#ifdef _WIN32
WINDOWPLACEMENT plc;
plc.length = sizeof(WINDOWPLACEMENT);
if(GetWindowPlacement(hWnd, &plc))
gameConf.window_maximized = (plc.showCmd == SW_SHOWMAXIMIZED);
#endif // _WIN32
if(!gameConf.window_maximized) {
gameConf.window_width = window_size.Width;
gameConf.window_height = window_size.Height;
}
wMainMenu->setRelativePosition(ResizeWin(370, 200, 650, 415));
wDeckEdit->setRelativePosition(Resize(309, 8, 605, 130));
cbDBLFList->setRelativePosition(Resize(80, 5, 220, 30));
......
......@@ -42,6 +42,9 @@ struct Config {
int chkIgnoreDeckChanges;
int defaultOT;
int enable_bot_mode;
bool window_maximized;
int window_width;
int window_height;
};
struct DuelInfo {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment