I'm using Windows 10 Professional high contrast mode for working at night.
I'm working in a Cocos2d-x 3.15 project, which using these following Win32 API:
UINT TARGET_RESOLUTION = 1; // 1 millisecond target resolution
TIMECAPS tc;
UINT wTimerRes = 0;
if (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(TIMECAPS)))
{
wTimerRes = std::min(std::max(tc.wPeriodMin, TARGET_RESOLUTION), tc.wPeriodMax);
timeBeginPeriod(wTimerRes);// request minimum time resolution to 1
}
It's not truly these following code, just an example.
while(true)//main loop
{
mainGameLoop();
int workedTime= calculateWorkedTime();// miliseconds
if(workedTime < 1000/60)// target 60fps
{
int remainingTime = 1000/60 - workedTime;
Sleep(remainingTime);
}
}
In normal state, my game will run at 60fps on Windows (nearly 60fps). But in high contrast, the game is limited to 30fps (feel very annoying when testing games).
I played many games that have 60fps fine. Can I do some trick in my project to bypass the 30fps limit (using Win32 API)?
p/s: This project uses OpenGL.