|
@@ -345,7 +345,8 @@ static void FramePresent(ImGui_ImplVulkanH_Window* wd)
|
|
|
int main(int, char**)
|
|
|
{
|
|
|
// Setup SDL
|
|
|
- if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD) != 0)
|
|
|
+ // [If using SDL_MAIN_USE_CALLBACKS: all code below until the main loop starts would likely be your SDL_AppInit() function]
|
|
|
+ if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_GAMEPAD))
|
|
|
{
|
|
|
printf("Error: SDL_Init(): %s\n", SDL_GetError());
|
|
|
return -1;
|
|
@@ -447,6 +448,7 @@ int main(int, char**)
|
|
|
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
|
|
|
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
|
|
|
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
|
|
|
+ // [If using SDL_MAIN_USE_CALLBACKS: call ImGui_ImplSDL3_ProcessEvent() from your SDL_AppEvent() function]
|
|
|
SDL_Event event;
|
|
|
while (SDL_PollEvent(&event))
|
|
|
{
|
|
@@ -456,6 +458,8 @@ int main(int, char**)
|
|
|
if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED && event.window.windowID == SDL_GetWindowID(window))
|
|
|
done = true;
|
|
|
}
|
|
|
+
|
|
|
+ // [If using SDL_MAIN_USE_CALLBACKS: all code below would likely be your SDL_AppIterate() function]
|
|
|
if (SDL_GetWindowFlags(window) & SDL_WINDOW_MINIMIZED)
|
|
|
{
|
|
|
SDL_Delay(10);
|
|
@@ -531,6 +535,7 @@ int main(int, char**)
|
|
|
}
|
|
|
|
|
|
// Cleanup
|
|
|
+ // [If using SDL_MAIN_USE_CALLBACKS: all code below would likely be your SDL_AppQuit() function]
|
|
|
err = vkDeviceWaitIdle(g_Device);
|
|
|
check_vk_result(err);
|
|
|
ImGui_ImplVulkan_Shutdown();
|