Skip to content

Commit

Permalink
Limit FPS in case vsync fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ArijanJ committed Jun 20, 2023
1 parent 785a46c commit 5496822
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// Main loop
bool done = false;
while (!done) {
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application.
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
SDL_Event event;
while (SDL_PollEvent(&event)) {
ImGui_ImplSDL2_ProcessEvent(&event);
Expand Down Expand Up @@ -616,6 +614,10 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
//SDL_SetRelativeMouseMode(SDL_TRUE);
SDL_SetWindowPosition(window, winx + x, winy + y);
}

// Limit the FPS to 100
// TODO: Rewrite this entire trainwreck of a project
SDL_Delay(10);

// Rendering
ImGui::Render();
Expand Down Expand Up @@ -752,3 +754,4 @@ void pollCallback(PmTimestamp timestamp, uint8_t status, PmMessage Data1, PmMess
}
logger.AddLog("%s: status: %x, %d, %d\n", timestampString(timestamp).c_str(), status, Data1, Data2);
}

0 comments on commit 5496822

Please sign in to comment.