1
0
mirror of https://github.com/FunkyFr3sh/cnc-ddraw.git synced 2025-03-15 06:04:49 +01:00

Add support for borderless mode

This commit is contained in:
Toni Spets 2011-07-09 15:20:57 +03:00
parent 83fba414d4
commit 921684fed8
2 changed files with 21 additions and 1 deletions

21
main.c
View File

@ -212,7 +212,14 @@ HRESULT __stdcall ddraw_SetDisplayMode(IDirectDrawImpl *This, DWORD width, DWORD
{
if(!This->windowed_init)
{
SetWindowLong(This->hWnd, GWL_STYLE, GetWindowLong(This->hWnd, GWL_STYLE) | WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX);
if (!This->border)
{
SetWindowLong(This->hWnd, GWL_STYLE, GetWindowLong(This->hWnd, GWL_STYLE) & ~(WS_CAPTION | WS_THICKFRAME | WS_MINIMIZE | WS_MAXIMIZE | WS_SYSMENU));
}
else
{
SetWindowLong(This->hWnd, GWL_STYLE, GetWindowLong(This->hWnd, GWL_STYLE) | WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX);
}
/* center the window with correct dimensions */
int x = (This->mode.dmPelsWidth / 2) - (This->render.width / 2);
@ -592,6 +599,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
"; bits per pixel, possible values: 16, 24 and 32, 0 = auto\n"
"bpp=0\n"
"windowed=true\n"
"; show window borders in windowed mode\n"
"border=true\n"
"; real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n"
"maxfps=0\n"
"; vertical synchronization, enable if you get tearing (OpenGL only)\n"
@ -622,6 +631,16 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
This->windowed = TRUE;
}
GetPrivateProfileStringA("ddraw", "border", "TRUE", tmp, sizeof(tmp), ini_path);
if(tolower(tmp[0]) == 'n' || tolower(tmp[0]) == 'f' || tmp[0] == '0')
{
This->border = FALSE;
}
else
{
This->border = TRUE;
}
This->render.maxfps = GetPrivateProfileIntA("ddraw", "maxfps", 0, ini_path);
This->render.width = GetPrivateProfileIntA("ddraw", "width", 640, ini_path);
if(This->render.width < 640)

1
main.h
View File

@ -38,6 +38,7 @@ typedef struct IDirectDrawImpl
DWORD height;
DWORD bpp;
BOOL windowed;
BOOL border;
BOOL windowed_init;
DEVMODE mode;
struct IDirectDrawSurfaceImpl *primary;