From 4901c4880e652e5ff74bd759049ccf628d8fb4b4 Mon Sep 17 00:00:00 2001 From: tma Date: Sun, 3 Aug 2008 19:42:53 +0000 Subject: * Change win32 client Sys_Sleep so it ONLY sleeps since before it was waking on more or less any input event; fine for the server, not so much use for the client * In the main loop, don't bother sleeping if it's going to be less than 10ms as the methods we're using to sleep at the moment aren't very precise * Add Sys_PlatformInit for platform specific initialisation * In win32 Sys_PlatformInit force selection of the DirectX SDL backend in order to get better fullscreen mouse input (in conjunction with a patched SDL DLL http://bugzilla.libsdl.org/show_bug.cgi?id=265) git-svn-id: svn://svn.icculus.org/quake3/trunk@1434 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/qcommon/common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'code/qcommon') diff --git a/code/qcommon/common.c b/code/qcommon/common.c index 475d045..b35d848 100644 --- a/code/qcommon/common.c +++ b/code/qcommon/common.c @@ -2864,7 +2864,14 @@ void Com_Frame( void ) { msec = minMsec; do { - Sys_Sleep( minMsec - msec ); + int timeRemaining = minMsec - msec; + + // The existing Sys_Sleep implementations aren't really + // precise enough to be of use beyond 100fps + // FIXME: implement a more precise sleep (RDTSC or something) + if( timeRemaining >= 10 ) + Sys_Sleep( timeRemaining ); + com_frameTime = Com_EventLoop(); if ( lastTime > com_frameTime ) { lastTime = com_frameTime; // possible on first frame -- cgit v1.2.3