Lose sound when switching between Tic80 editor and different desktop app #518
This commit is contained in:
parent
8d9251657d
commit
6721fb6d8d
File diff suppressed because one or more lines are too long
BIN
config.tic
BIN
config.tic
Binary file not shown.
24
src/studio.c
24
src/studio.c
|
@ -2823,25 +2823,13 @@ s32 main(s32 argc, char **argv)
|
||||||
}
|
}
|
||||||
else createFileSystem(NULL, onFSInitialized);
|
else createFileSystem(NULL, onFSInitialized);
|
||||||
|
|
||||||
emscripten_set_main_loop(emstick, TIC_FRAMERATE, 1);
|
emscripten_set_main_loop(getConfig()->useVsync ? tick : emstick, TIC_FRAMERATE, 1);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
createFileSystem(argc > 1 && fsExists(argv[1]) ? fsBasename(argv[1]) : NULL, onFSInitialized);
|
createFileSystem(argc > 1 && fsExists(argv[1]) ? fsBasename(argv[1]) : NULL, onFSInitialized);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
bool useDelay = false;
|
|
||||||
{
|
|
||||||
SDL_RendererInfo info;
|
|
||||||
SDL_DisplayMode mode;
|
|
||||||
|
|
||||||
SDL_GetRendererInfo(studio.renderer, &info);
|
|
||||||
SDL_GetCurrentDisplayMode(SDL_GetWindowDisplayIndex(studio.window), &mode);
|
|
||||||
|
|
||||||
useDelay = !(info.flags & SDL_RENDERER_PRESENTVSYNC) || mode.refresh_rate > TIC_FRAMERATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 nextTick = SDL_GetPerformanceCounter();
|
u64 nextTick = SDL_GetPerformanceCounter();
|
||||||
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
const u64 Delta = SDL_GetPerformanceFrequency() / TIC_FRAMERATE;
|
||||||
|
|
||||||
|
@ -2860,15 +2848,7 @@ s32 main(s32 argc, char **argv)
|
||||||
nextTick -= delay;
|
nextTick -= delay;
|
||||||
studio.missedFrame = true;
|
studio.missedFrame = true;
|
||||||
}
|
}
|
||||||
else
|
else SDL_Delay((u32)(delay * 1000 / SDL_GetPerformanceFrequency()));
|
||||||
{
|
|
||||||
if(useDelay || SDL_GetWindowFlags(studio.window) & SDL_WINDOW_MINIMIZED)
|
|
||||||
{
|
|
||||||
u32 time = (u32)(delay * 1000 / SDL_GetPerformanceFrequency());
|
|
||||||
if(time >= 10)
|
|
||||||
SDL_Delay(time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue