mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Reduce dependency on libgcc
This commit is contained in:
parent
666449416a
commit
8b08fe3abb
4
.github/workflows/build_mac32.yml
vendored
4
.github/workflows/build_mac32.yml
vendored
@ -31,8 +31,8 @@ jobs:
|
||||
|
||||
cd src
|
||||
PATH=$PATH:/usr/local/compiler/target/bin
|
||||
i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -o cc-mac32-gl1 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -lgcc_s.1
|
||||
i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -o cc-mac32-gl2 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -lgcc_s.1
|
||||
i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -o cc-mac32-gl1 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -static-libgcc
|
||||
i386-apple-darwin8-clang *.c Window_cocoa.m ${{ env.COMMON_FLAGS }} $LATEST_FLAG -DCC_GFX_BACKEND=CC_GFX_BACKEND_GL2 -o cc-mac32-gl2 -framework Cocoa -framework OpenGL -framework IOKit -lobjc -static-libgcc
|
||||
|
||||
|
||||
- uses: ./.github/actions/notify_failure
|
||||
|
13
src/Game.c
13
src/Game.c
@ -636,13 +636,20 @@ static void LimitFPS(void) {
|
||||
#else
|
||||
static float gfx_targetTime, gfx_actualTime;
|
||||
|
||||
static CC_INLINE float ElapsedMilliseconds(cc_uint64 beg, cc_uint64 end) {
|
||||
cc_uint64 elapsed = Stopwatch_ElapsedMicroseconds(beg, end);
|
||||
if (elapsed > 5000000) elapsed = 5000000;
|
||||
|
||||
return (int)elapsed / 1000.0f;
|
||||
}
|
||||
|
||||
/* Examines difference between expected and actual frame times, */
|
||||
/* then sleeps if actual frame time is too fast */
|
||||
static void LimitFPS(void) {
|
||||
cc_uint64 frameEnd, sleepEnd;
|
||||
|
||||
frameEnd = Stopwatch_Measure();
|
||||
gfx_actualTime += Stopwatch_ElapsedMicroseconds(frameStart, frameEnd) / 1000.0f;
|
||||
gfx_actualTime += ElapsedMilliseconds(frameStart, frameEnd);
|
||||
gfx_targetTime += gfx_minFrameMs;
|
||||
|
||||
/* going faster than FPS limit - sleep to slow down */
|
||||
@ -654,7 +661,7 @@ static void LimitFPS(void) {
|
||||
/* duration can significantly deviate from requested time */
|
||||
/* (e.g. requested 4ms, but actually slept for 8ms) */
|
||||
sleepEnd = Stopwatch_Measure();
|
||||
gfx_actualTime += Stopwatch_ElapsedMicroseconds(frameEnd, sleepEnd) / 1000.0f;
|
||||
gfx_actualTime += ElapsedMilliseconds(frameEnd, sleepEnd);
|
||||
}
|
||||
|
||||
/* reset accumulated time to avoid excessive FPS drift */
|
||||
@ -728,7 +735,7 @@ static CC_INLINE void Game_RenderFrame(void) {
|
||||
/* avoid large delta with suspended process */
|
||||
if (elapsed > 5000000) elapsed = 5000000;
|
||||
|
||||
double deltaD = elapsed / (1000.0 * 1000.0);
|
||||
double deltaD = (int)elapsed / (1000.0 * 1000.0);
|
||||
float delta = (float)deltaD;
|
||||
Window_ProcessEvents(delta);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user