File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ std::string Window::GetDropFile() {
130
130
return tmp;
131
131
}
132
132
133
- Window::Status Window::ProcessEvents () {
133
+ Window::Status Window::NewFrame () {
134
134
SDL_Event event;
135
135
while (SDL_PollEvent (&event)) {
136
136
ImGui_ImplSDL2_ProcessEvent (&event);
@@ -158,6 +158,15 @@ Window::Status Window::ProcessEvents() {
158
158
return should_exit_ ? kQuitting : kRunning ;
159
159
}
160
160
161
+ void Window::EndFrame () {
162
+ // We use ImGui for input management in addition to GUI rendering so its
163
+ // important to call ImGui::EndFrame even if we don't call ImGui::Render.
164
+ // Note ImGui::Render internally calls ImGui::EndFrame, but so long as
165
+ // ImGui::NewFrame has been called, ImGui::EndFrame may be called multiple
166
+ // times; it will be a no-op.
167
+ ImGui::EndFrame ();
168
+ }
169
+
161
170
void Window::Present () {
162
171
// Filament (with the exception of WebGL) handles the swapchain internally.
163
172
if (config_ != kFilamentVulkan && config_ != kFilamentOpenGL ) {
Original file line number Diff line number Diff line change @@ -50,8 +50,12 @@ class Window {
50
50
kQuitting ,
51
51
};
52
52
53
- // Processes all pendings window events, returning the status of the window.
54
- Status ProcessEvents ();
53
+ // Processes all pendings window events and prepares ImGui for input handling
54
+ // and GUI rendering. Returns the status of the window.
55
+ Status NewFrame ();
56
+
57
+ // Finalizes ImGui input handling. Must call NewFrame first.
58
+ void EndFrame ();
55
59
56
60
// Swaps and presents the window buffer.
57
61
void Present ();
You can’t perform that action at this time.
0 commit comments