Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental: Save CPU When Losing Focus #402

Open
wants to merge 2 commits into
base: v0_8
Choose a base branch
from

Commits on Sep 12, 2024

  1. Feature: Save CPU When Losing Focus

    TL;DR: Refactor event handling and add performance option
    
    This update saves power without requiring changes to animation and physics animations.
    
    Related issue: nijigenerate/nijigenerate#21
    
    * Refactored the event handling in the `incBeginLoop` function to use a state machine for managing poll and wait modes, reducing CPU usage when the application is not focused.
    * Added a new performance option in the settings window called `Render Only When Window Focused`.  Enabling this option stops rendering when the window loses focus, further reducing CPU usage.
    * This feature is enabled by default
    r888800009 committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    ef5503e View commit details
    Browse the repository at this point in the history
  2. Pass SDL_WINDOWEVENT to imgui

    we can see the source code for this in imgui_impl_sdl2.cpp:ImGui_ImplSDL2_ProcessEvent()
    https://github.com/ocornut/imgui/blob/master/backends/imgui_impl_sdl2.cpp
    imgui will handle SDL_WINDOWEVENT, so we need to pass it to imgui
    incGLBackendProcessEvent() would invoke ImGui_ImplSDL2_ProcessEvent()
    r888800009 committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    a5e5214 View commit details
    Browse the repository at this point in the history