mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
maintain aspect ratio
This commit is contained in:
parent
8978f7320a
commit
ecaaf8e647
8
ddraw.rc
8
ddraw.rc
@ -1,6 +1,6 @@
|
||||
1 VERSIONINFO
|
||||
FILEVERSION 1,1,5,3
|
||||
PRODUCTVERSION 1,1,5,3
|
||||
FILEVERSION 1,1,5,4
|
||||
PRODUCTVERSION 1,1,5,4
|
||||
{
|
||||
BLOCK "StringFileInfo"
|
||||
{
|
||||
@ -8,13 +8,13 @@ PRODUCTVERSION 1,1,5,3
|
||||
{
|
||||
VALUE "CompanyName", "cncnet.org"
|
||||
VALUE "FileDescription", "DirectDraw replacement for C&C95 and Red Alert"
|
||||
VALUE "FileVersion", "1.1.5.3"
|
||||
VALUE "FileVersion", "1.1.5.4"
|
||||
VALUE "InternalName", "ddraw"
|
||||
VALUE "LegalCopyright", "Copyright (c) 2010-2018"
|
||||
VALUE "LegalTrademarks", ""
|
||||
VALUE "OriginalFileName", "ddraw.dll"
|
||||
VALUE "ProductName", "DirectDraw replacement for C&C95 and Red Alert"
|
||||
VALUE "ProductVersion", "1.1.5.3"
|
||||
VALUE "ProductVersion", "1.1.5.4"
|
||||
VALUE "Comments", "https://cncnet.org"
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ typedef struct IDirectDrawImpl
|
||||
char screenshotKey;
|
||||
BOOL opengl_pbo;
|
||||
BOOL fullscreen;
|
||||
BOOL maintas;
|
||||
|
||||
} IDirectDrawImpl;
|
||||
|
||||
|
12
src/main.c
12
src/main.c
@ -895,6 +895,8 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
|
||||
"windowed=false\n"
|
||||
"; show window borders in windowed mode\n"
|
||||
"border=true\n"
|
||||
"; maintain aspect ratio (GDI only!)\n"
|
||||
"maintas=false\n"
|
||||
"; use letter- or windowboxing to make a best fit (GDI only!)\n"
|
||||
"boxing=false\n"
|
||||
"; real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n"
|
||||
@ -961,6 +963,16 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
|
||||
{
|
||||
This->boxing = TRUE;
|
||||
}
|
||||
|
||||
GetPrivateProfileStringA("ddraw", "maintas", "FALSE", tmp, sizeof(tmp), SettingsIniPath);
|
||||
if (tolower(tmp[0]) == 'n' || tolower(tmp[0]) == 'f' || tolower(tmp[0]) == 'd' || tmp[0] == '0')
|
||||
{
|
||||
This->maintas = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
This->maintas = TRUE;
|
||||
}
|
||||
|
||||
GetPrivateProfileStringA("ddraw", "screenshotKey", "G", tmp, sizeof(tmp), SettingsIniPath);
|
||||
ddraw->screenshotKey = toupper(tmp[0]);
|
||||
|
@ -69,7 +69,21 @@ DWORD WINAPI render_soft_main(void)
|
||||
DWORD tick_end = 0;
|
||||
DWORD frame_len = 0;
|
||||
|
||||
if (ddraw->boxing)
|
||||
if (ddraw->maintas)
|
||||
{
|
||||
dst_width = ddraw->render.width;
|
||||
dst_height = ((float)ddraw->height / ddraw->width) * dst_width;
|
||||
|
||||
if (dst_height > ddraw->render.height)
|
||||
{
|
||||
dst_width = ((float)dst_width / dst_height) * ddraw->render.height;
|
||||
dst_height = ddraw->render.height;
|
||||
}
|
||||
|
||||
dst_top = ddraw->render.height / 2 - dst_height / 2;
|
||||
dst_left = ddraw->render.width / 2 - dst_width / 2;
|
||||
}
|
||||
else if (ddraw->boxing)
|
||||
{
|
||||
dst_width = ddraw->width;
|
||||
dst_height = ddraw->height;
|
||||
|
Loading…
x
Reference in New Issue
Block a user