X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=sys_sdl.c;h=6ca7812961ff51c393417f4caad952dd55d35580;hb=547431f0203479c4e594e1e85cb294ea843282b9;hp=702cfaf881a85c7c801c72b22e476723f89af3af;hpb=cd7454f9df6b152a24c5a28750041d27023fbc1f;p=xonotic%2Fdarkplaces.git diff --git a/sys_sdl.c b/sys_sdl.c index 702cfaf8..6ca78129 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -1,3 +1,4 @@ +#include "quakedef.h" #ifdef WIN32 #include @@ -10,8 +11,6 @@ #include -#include "quakedef.h" - #include // ======================================================================= @@ -54,6 +53,8 @@ void Sys_PrintToTerminal(const char *text) // BUG: for some reason, NDELAY also affects stdout (1) when used on stdin (0). int origflags = fcntl (1, F_GETFL, 0); fcntl (1, F_SETFL, origflags & ~FNDELAY); +#else +#define write _write #endif while(*text) { @@ -88,6 +89,10 @@ double Sys_DoubleTime (void) if (newtime - oldtime < -0.01) Con_Printf("Sys_DoubleTime: time stepped backwards (went from %f to %f, difference %f)\n", oldtime, newtime, newtime - oldtime); } + else if (newtime > oldtime + 1800) + { + Con_Printf("Sys_DoubleTime: time stepped forward (went from %f to %f, difference %f)\n", oldtime, newtime, newtime - oldtime); + } else curtime += newtime - oldtime; oldtime = newtime; @@ -108,11 +113,11 @@ char *Sys_ConsoleInput(void) while (_kbhit ()) { c = _getch (); - putch (c); + _putch (c); if (c == '\r') { text[len] = 0; - putch ('\n'); + _putch ('\n'); len = 0; return text; } @@ -120,8 +125,8 @@ char *Sys_ConsoleInput(void) { if (len) { - putch (' '); - putch (c); + _putch (' '); + _putch (c); len--; text[len] = 0; } @@ -155,11 +160,9 @@ char *Sys_ConsoleInput(void) return NULL; } -void Sys_Sleep(int milliseconds) +void Sys_Sleep(int microseconds) { - if (milliseconds < 1) - milliseconds = 1; - SDL_Delay(milliseconds); + SDL_Delay(microseconds / 1000); } char *Sys_GetClipboardData (void)