even less waiting

This commit is contained in:
Tim Felgentreff 2020-12-23 18:04:51 +01:00
parent 9551c2b883
commit ea777ce963
3 changed files with 15 additions and 0 deletions

1
.gitignore vendored
View file

@ -33,3 +33,4 @@ build
!.vscode/scripts
.clangd
compile_commands.json
pytorchenv

View file

@ -770,6 +770,8 @@ static void GameTypeMachineVsMachineTraining()
FastForwardCycle = LONG_MAX;
SyncHash = 0;
InitSyncRand();
SetEffectsEnabled(false);
SetMusicEnabled(false);
for (int i = 0; i < MyRand() % 100; i++) {
SyncRand();
}

View file

@ -105,6 +105,8 @@ const EventCallback *Callbacks;
bool IsSDLWindowVisible = true;
static bool dummyRenderer = false;
uint32_t SDL_CUSTOM_KEY_UP;
/*----------------------------------------------------------------------------
@ -375,6 +377,9 @@ void InitVideoSdl()
SDL_RendererInfo rendererInfo;
SDL_GetRendererInfo(TheRenderer, &rendererInfo);
printf("[Renderer] %s\n", rendererInfo.name);
if (strlen(rendererInfo.name) == 0) {
dummyRenderer = true;
}
if(!strncmp(rendererInfo.name, "opengl", 6)) {
LoadShaderExtensions();
}
@ -673,6 +678,10 @@ void WaitEventsOneFrame()
{
++FrameCounter;
if (dummyRenderer) {
return;
}
Uint32 ticks = SDL_GetTicks();
if (ticks > NextFrameTicks) { // We are too slow :(
++SlowFrameCounter;
@ -734,6 +743,9 @@ static Uint32 LastTick = 0;
void RealizeVideoMemory()
{
if (dummyRenderer) {
return;
}
if (NumRects) {
//SDL_UpdateWindowSurfaceRects(TheWindow, Rects, NumRects);
SDL_UpdateTexture(TheTexture, NULL, TheScreen->pixels, TheScreen->pitch);