Revert "Send both update and render events on Windows resize/move"

This reverts commit a2413c4fad.
This commit is contained in:
Joshua Granick
2020-03-31 14:30:56 -07:00
parent 43666e816d
commit 8fc7b43eda
2 changed files with 24 additions and 28 deletions

View File

@@ -127,7 +127,26 @@ namespace lime {
case SDL_USEREVENT:
SendUpdateEvent();
if (!inBackground) {
currentUpdate = SDL_GetTicks ();
applicationEvent.type = UPDATE;
applicationEvent.deltaTime = currentUpdate - lastUpdate;
lastUpdate = currentUpdate;
nextUpdate += framePeriod;
while (nextUpdate <= currentUpdate) {
nextUpdate += framePeriod;
}
ApplicationEvent::Dispatch (&applicationEvent);
RenderEvent::Dispatch (&renderEvent);
}
break;
case SDL_APP_WILLENTERBACKGROUND:
@@ -808,31 +827,6 @@ namespace lime {
}
void SDLApplication::SendUpdateEvent () {
if (!inBackground) {
currentUpdate = SDL_GetTicks ();
applicationEvent.type = UPDATE;
applicationEvent.deltaTime = currentUpdate - lastUpdate;
lastUpdate = currentUpdate;
nextUpdate += framePeriod;
while (nextUpdate <= currentUpdate) {
nextUpdate += framePeriod;
}
ApplicationEvent::Dispatch (&applicationEvent);
RenderEvent::Dispatch (&renderEvent);
}
}
void SDLApplication::SetFrameRate (double frameRate) {
if (frameRate > 0) {
@@ -1020,11 +1014,14 @@ namespace lime {
winTimerActive = SetTimer (GetActiveWindow (), winTimerID, currentApplication->framePeriod, nullptr);
// TODO: Are we thread-safe to call GL here?
RenderEvent::Dispatch (&currentApplication->renderEvent);
} else if (message.msg == WM_TIMER) {
if (message.wParam == winTimerID) {
currentApplication->SendUpdateEvent ();
RenderEvent::Dispatch (&currentApplication->renderEvent);
}

View File

@@ -50,7 +50,6 @@ namespace lime {
void ProcessTextEvent (SDL_Event* event);
void ProcessTouchEvent (SDL_Event* event);
void ProcessWindowEvent (SDL_Event* event);
void SendUpdateEvent ();
int WaitEvent (SDL_Event* event);
static void UpdateFrame ();