Inline busy waiting code instead of using static function
This commit is contained in:
parent
4e3a1f9922
commit
04ad3c7cc6
17
src/rcore.c
17
src/rcore.c
|
|
@ -686,10 +686,6 @@ static void RecordAutomationEvent(unsigned int frame); // Record frame even
|
||||||
static void PlayAutomationEvent(unsigned int frame); // Play frame events (from internal events array)
|
static void PlayAutomationEvent(unsigned int frame); // Play frame events (from internal events array)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_BUSY_WAIT_LOOP) || defined(SUPPORT_PARTIALBUSY_WAIT_LOOP)
|
|
||||||
static void BusyWaitUntil(double destinationTime);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
// NOTE: We declare Sleep() function symbol to avoid including windows.h (kernel32.lib linkage required)
|
// NOTE: We declare Sleep() function symbol to avoid including windows.h (kernel32.lib linkage required)
|
||||||
void __stdcall Sleep(unsigned long msTimeout); // Required for: WaitTime()
|
void __stdcall Sleep(unsigned long msTimeout); // Required for: WaitTime()
|
||||||
|
|
@ -4835,7 +4831,7 @@ void WaitTime(double seconds)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_BUSY_WAIT_LOOP)
|
#if defined(SUPPORT_BUSY_WAIT_LOOP)
|
||||||
BusyWaitUntil(destinationTime);
|
while (GetTime() < destinationTime) { }
|
||||||
#else
|
#else
|
||||||
#if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP)
|
#if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP)
|
||||||
double sleepSeconds = seconds - seconds*0.05; // NOTE: We reserve a percentage of the time for busy waiting
|
double sleepSeconds = seconds - seconds*0.05; // NOTE: We reserve a percentage of the time for busy waiting
|
||||||
|
|
@ -4862,17 +4858,10 @@ void WaitTime(double seconds)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP)
|
#if defined(SUPPORT_PARTIALBUSY_WAIT_LOOP)
|
||||||
BusyWaitUntil(destinationTime);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(SUPPORT_BUSY_WAIT_LOOP) || defined(SUPPORT_PARTIALBUSY_WAIT_LOOP)
|
|
||||||
static void BusyWaitUntil(double destinationTime)
|
|
||||||
{
|
|
||||||
while (GetTime() < destinationTime) { }
|
while (GetTime() < destinationTime) { }
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
// Swap back buffer with front buffer (screen drawing)
|
// Swap back buffer with front buffer (screen drawing)
|
||||||
void SwapScreenBuffer(void)
|
void SwapScreenBuffer(void)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user