mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-15 06:04:49 +01:00
Add vsync ini option, controls GL_EXT_swap_control, default disabled
This commit is contained in:
parent
fe6322d165
commit
d066962617
14
main.c
14
main.c
@ -515,8 +515,10 @@ 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"
|
||||
"; real rendering rate, -1 = vsync, 0 = unlimited, n = cap\n"
|
||||
"; real rendering rate, -1 = screen rate, 0 = unlimited, n = cap\n"
|
||||
"maxfps=120\n"
|
||||
"; vertical synchronization, enable if you get tearing\n"
|
||||
"vsync=false\n"
|
||||
"; scaling filter, nearest = sharp, linear = smooth\n"
|
||||
"filter=nearest\n"
|
||||
"; mouse sensitivity scaling\n"
|
||||
@ -596,6 +598,16 @@ HRESULT WINAPI DirectDrawCreate(GUID FAR* lpGUID, LPDIRECTDRAW FAR* lplpDD, IUnk
|
||||
This->devmode = FALSE;
|
||||
}
|
||||
|
||||
GetPrivateProfileStringA("ddraw", "vsync", "FALSE", tmp, sizeof(tmp), ini_path);
|
||||
if(tolower(tmp[0]) == 'y' || tolower(tmp[0]) == 't' || tmp[0] == '1')
|
||||
{
|
||||
This->vsync = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
This->vsync = FALSE;
|
||||
}
|
||||
|
||||
This->Ref = 0;
|
||||
ddraw_AddRef(This);
|
||||
|
||||
|
1
main.h
1
main.h
@ -73,6 +73,7 @@ typedef struct IDirectDrawImpl
|
||||
BOOL adjmouse;
|
||||
BOOL mhack;
|
||||
BOOL devmode;
|
||||
BOOL vsync;
|
||||
|
||||
} IDirectDrawImpl;
|
||||
|
||||
|
18
render.c
18
render.c
@ -34,6 +34,24 @@ DWORD WINAPI render_main(void)
|
||||
hRC = wglCreateContext( ddraw->render.hDC );
|
||||
wglMakeCurrent( ddraw->render.hDC, hRC );
|
||||
|
||||
char *glext = (char *)glGetString(GL_EXTENSIONS);
|
||||
|
||||
if(glext && strstr(glext, "WGL_EXT_swap_control"))
|
||||
{
|
||||
BOOL (APIENTRY *wglSwapIntervalEXT)(int) = (BOOL (APIENTRY *)(int))wglGetProcAddress("wglSwapIntervalEXT");
|
||||
if(wglSwapIntervalEXT)
|
||||
{
|
||||
if(ddraw->vsync)
|
||||
{
|
||||
wglSwapIntervalEXT(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
wglSwapIntervalEXT(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DWORD tick_start;
|
||||
DWORD tick_end;
|
||||
DWORD frame_len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user