mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
remember window state
This commit is contained in:
parent
8d6e00d263
commit
c8c86f8282
@ -39,11 +39,12 @@ void mouse_unlock();
|
|||||||
/* from screenshot.c */
|
/* from screenshot.c */
|
||||||
BOOL screenshot(struct IDirectDrawSurfaceImpl *);
|
BOOL screenshot(struct IDirectDrawSurfaceImpl *);
|
||||||
void Settings_Load();
|
void Settings_Load();
|
||||||
void Settings_SaveWindowRect(RECT *lpRect);
|
void Settings_Save(RECT *lpRect, int windowState);
|
||||||
|
|
||||||
IDirectDrawImpl *ddraw = NULL;
|
IDirectDrawImpl *ddraw = NULL;
|
||||||
|
|
||||||
RECT WindowRect = { .left = -32000, .top = -32000, .right = 0, .bottom = 0 };
|
RECT WindowRect = { .left = -32000, .top = -32000, .right = 0, .bottom = 0 };
|
||||||
|
int WindowState = -1;
|
||||||
BOOL Direct3D9Active;
|
BOOL Direct3D9Active;
|
||||||
|
|
||||||
//BOOL WINAPI DllMainCRTStartup(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
|
//BOOL WINAPI DllMainCRTStartup(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
|
||||||
@ -92,7 +93,7 @@ BOOL WINAPI DllMain(HANDLE hDll, DWORD dwReason, LPVOID lpReserved)
|
|||||||
{
|
{
|
||||||
printf("cnc-ddraw DLL_PROCESS_DETACH\n");
|
printf("cnc-ddraw DLL_PROCESS_DETACH\n");
|
||||||
|
|
||||||
Settings_SaveWindowRect(&WindowRect);
|
Settings_Save(&WindowRect, WindowState);
|
||||||
|
|
||||||
timeEndPeriod(1);
|
timeEndPeriod(1);
|
||||||
break;
|
break;
|
||||||
@ -648,7 +649,7 @@ void ToggleFullscreen()
|
|||||||
if (ddraw->windowed)
|
if (ddraw->windowed)
|
||||||
{
|
{
|
||||||
mouse_unlock();
|
mouse_unlock();
|
||||||
ddraw->windowed = FALSE;
|
WindowState = ddraw->windowed = FALSE;
|
||||||
SetWindowLong(ddraw->hWnd, GWL_STYLE, GetWindowLong(ddraw->hWnd, GWL_STYLE) & ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU));
|
SetWindowLong(ddraw->hWnd, GWL_STYLE, GetWindowLong(ddraw->hWnd, GWL_STYLE) & ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU));
|
||||||
ddraw->altenter = TRUE;
|
ddraw->altenter = TRUE;
|
||||||
ddraw_SetDisplayMode(ddraw, ddraw->width, ddraw->height, 8);
|
ddraw_SetDisplayMode(ddraw, ddraw->width, ddraw->height, 8);
|
||||||
@ -657,7 +658,7 @@ void ToggleFullscreen()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
mouse_unlock();
|
mouse_unlock();
|
||||||
ddraw->windowed = TRUE;
|
WindowState = ddraw->windowed = TRUE;
|
||||||
|
|
||||||
if (Direct3D9Active)
|
if (Direct3D9Active)
|
||||||
Direct3D9_Reset();
|
Direct3D9_Reset();
|
||||||
|
@ -120,7 +120,7 @@ void Settings_Load()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings_SaveWindowRect(RECT *lpRect)
|
void Settings_Save(RECT *lpRect, int windowState)
|
||||||
{
|
{
|
||||||
char buf[16];
|
char buf[16];
|
||||||
|
|
||||||
@ -147,6 +147,11 @@ void Settings_SaveWindowRect(RECT *lpRect)
|
|||||||
sprintf(buf, "%ld", lpRect->top);
|
sprintf(buf, "%ld", lpRect->top);
|
||||||
WritePrivateProfileString(ProcessFileName, "posY", buf, SettingsIniPath);
|
WritePrivateProfileString(ProcessFileName, "posY", buf, SettingsIniPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (windowState != -1)
|
||||||
|
{
|
||||||
|
WritePrivateProfileString(ProcessFileName, "windowed", windowState ? "true" : "false", SettingsIniPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CreateSettingsIni()
|
static void CreateSettingsIni()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user