Refactor event handling in Controller::OnInput to use SDL_WaitEvent instead of polling; improves efficiency by reducing CPU usage during event processing.
This commit is contained in:
@@ -64,7 +64,7 @@ void Controller::OnInput() {
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
SDL_Event event;
|
||||
|
||||
while (SDL_PollEvent(&event)) {
|
||||
SDL_WaitEvent(&event);
|
||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
switch (event.type) {
|
||||
case SDL_KEYDOWN:
|
||||
@@ -91,7 +91,6 @@ void Controller::OnInput() {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int mouseX;
|
||||
int mouseY;
|
||||
|
||||
Reference in New Issue
Block a user