// (minor and older changes stripped away, please see git history for details)
// (minor and older changes stripped away, please see git history for details)
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2023-02-02: Inputs: Scaling X value on Emscripten (bug?). (#4019, #6096)
// 2023-02-03: Emscripten: Registering custom low-level mouse wheel handler to get more accurate scrolling impulses on Emscripten. (#4019, #6096)
// 2023-01-18: Handle unsupported glfwGetVideoMode() call on e.g. Emscripten.
// 2023-01-18: Handle unsupported glfwGetVideoMode() call on e.g. Emscripten.
// 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty.
// 2023-01-04: Inputs: Fixed mods state on Linux when using Alt-GR text input (e.g. German keyboard layout), could lead to broken text input. Revert a 2022/01/17 change were we resumed using mods provided by GLFW, turns out they were faulty.
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
// 2022-11-22: Perform a dummy glfwGetError() read to cancel missing names with glfwGetKeyName(). (#5908)
@ -87,6 +87,11 @@
#include<GLFW/glfw3native.h> // for glfwGetCocoaWindow()
#include<GLFW/glfw3native.h> // for glfwGetCocoaWindow()
#endif
#endif
#ifdef __EMSCRIPTEN__
#include<emscripten.h>
#include<emscripten/html5.h>
#endif
// We gather version tests as define in order to easily see which features are version-dependent.
// We gather version tests as define in order to easily see which features are version-dependent.
@ -30,13 +30,17 @@ IMGUI_IMPL_API bool ImGui_ImplGlfw_InitForOther(GLFWwindow* window, bool ins
IMGUI_IMPL_APIvoidImGui_ImplGlfw_Shutdown();
IMGUI_IMPL_APIvoidImGui_ImplGlfw_Shutdown();
IMGUI_IMPL_APIvoidImGui_ImplGlfw_NewFrame();
IMGUI_IMPL_APIvoidImGui_ImplGlfw_NewFrame();
// GLFW callbacks (installer)
// GLFW callbacks install
// - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any.
// - When calling Init with 'install_callbacks=true': ImGui_ImplGlfw_InstallCallbacks() is called. GLFW callbacks will be installed for you. They will chain-call user's previously installed callbacks, if any.
// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks.
// - When calling Init with 'install_callbacks=false': GLFW callbacks won't be installed. You will need to call individual function yourself from your own GLFW callbacks.
// (minor and older changes stripped away, please see git history for details)
// (minor and older changes stripped away, please see git history for details)
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2023-XX-XX: Platform: Added support for multiple windows via the ImGuiPlatformIO interface.
// 2023-02-02: Avoid calling SDL_SetCursor() when cursor has not changed, as the function is surprisingly costly on Mac with latest SDL (may be fixed in next SDL version).
// 2023-02-02: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data for smooth scrolling + Scaling X value on Emscripten (bug?). (#4019, #6096)
// 2023-02-02: Added support for SDL 2.0.18+ preciseX/preciseY mouse wheel data for smooth scrolling + Scaling X value on Emscripten (bug?). (#4019, #6096)
// 2023-02-02: Removed SDL_MOUSEWHEEL value clamping, as values seem correct in latest Emscripten. (#4019)
// 2023-02-02: Removed SDL_MOUSEWHEEL value clamping, as values seem correct in latest Emscripten. (#4019)
// 2023-02-01: Flipping SDL_MOUSEWHEEL 'wheel.x' value to match other backends and offer consistent horizontal scrolling direction. (#4019, #6096, #1463)
// 2023-02-01: Flipping SDL_MOUSEWHEEL 'wheel.x' value to match other backends and offer consistent horizontal scrolling direction. (#4019, #6096, #1463)
// Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
booldone=false;
ALLEGRO_EVENTev;
while(al_get_next_event(queue,&ev))
{
{
ImGui_ImplAllegro5_ProcessEvent(&ev);
// Poll and handle events (inputs, window resize, etc.)
if(ev.type==ALLEGRO_EVENT_DISPLAY_CLOSE)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
done=true;
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
if(ev.type==ALLEGRO_EVENT_DISPLAY_RESIZE)
// - 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.
ALLEGRO_EVENTev;
while(al_get_next_event(queue,&ev))
{
{
ImGui_ImplAllegro5_InvalidateDeviceObjects();
ImGui_ImplAllegro5_ProcessEvent(&ev);
al_acknowledge_resize(display);
if(ev.type==ALLEGRO_EVENT_DISPLAY_CLOSE)
ImGui_ImplAllegro5_CreateDeviceObjects();
running=false;
if(ev.type==ALLEGRO_EVENT_DISPLAY_RESIZE)
{
ImGui_ImplAllegro5_InvalidateDeviceObjects();
al_acknowledge_resize(display);
ImGui_ImplAllegro5_CreateDeviceObjects();
}
}
}
}
if(done)
returnfalse;
// Start the Dear ImGui frame
// Start the Dear ImGui frame
ImGui_ImplAllegro5_NewFrame();
ImGui_ImplAllegro5_NewFrame();
ImGui::NewFrame();
ImGui::NewFrame();
// Our state
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
// (we use static, which essentially makes the variable globals, as a convenience to keep the example code easy to follow)
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
counter++;
ImGui::End();
ImGui::SameLine();
}
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
// 3. Show another simple window.
ImGui::End();
if(show_another_window)
}
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
glfwPollEvents();
// Start the Dear ImGui frame
ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if(show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
{
staticfloatf=0.0f;
staticintcounter=0;
ImGui::Begin("Hello, world!");// Create a window called "Hello, world!" and append into it.
ImGui::Text("This is some useful text.");// Display some text (you can use a format strings too)
ImGui::Checkbox("Demo Window",&show_demo_window);// Edit bools storing our window open/close state
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
GLFWwindow*window=g_AppWindow;
glfwPollEvents();
// Start the Dear ImGui frame
ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// Our state
// (we use static, which essentially makes the variable globals, as a convenience to keep the example code easy to follow)
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
glfwPollEvents();
// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
if(show_demo_window)
ImGui::ShowDemoWindow(&show_demo_window);
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
{
staticfloatf=0.0f;
staticintcounter=0;
ImGui::Begin("Hello, world!");// Create a window called "Hello, world!" and append into it.
ImGui::Text("This is some useful text.");// Display some text (you can use a format strings too)
ImGui::Checkbox("Demo Window",&show_demo_window);// Edit bools storing our window open/close state
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
GLFWwindow*window=g_AppWindow;
glfwPollEvents();
// Start the Dear ImGui frame
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// Our state
// (we use static, which essentially makes the variable globals, as a convenience to keep the example code easy to follow)
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
GLFWwindow*window=g_AppWindow;
glfwPollEvents();
// Resize swap chain?
if(g_SwapChainRebuild)
{
{
intwidth,height;
// Poll and handle events (inputs, window resize, etc.)
glfwGetFramebufferSize(window,&width,&height);
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
if(width>0&&height>0)
// - 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.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
counter++;
ImGui::End();
ImGui::SameLine();
}
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
// 3. Show another simple window.
ImGui::End();
if(show_another_window)
}
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
show_another_window=false;
ImGui::End();
}
// 3. Show another simple window.
// Rendering
if(show_another_window)
ImGui::Render();
{
ImDrawData*main_draw_data=ImGui::GetDrawData();
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle SDL events (inputs, window resize, etc.)
while(!done)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
SDL_Window*window=g_AppWindow;
SDL_Eventevent;
while(SDL_PollEvent(&event))
{
{
ImGui_ImplSDL2_ProcessEvent(&event);
// Poll and handle events (inputs, window resize, etc.)
if(event.type==SDL_QUIT)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
returnfalse;
// - 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.
returnfalse;
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
counter++;
ImGui::End();
ImGui::SameLine();
}
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
// 3. Show another simple window.
ImGui::End();
if(show_another_window)
}
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
break;
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle SDL events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle SDL events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
break;
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
counter++;
ImGui::SameLine();
ImGui::Text("counter = %d",counter);
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::End();
}
// 3. Show another simple window.
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Poll and handle events (inputs, window resize, etc.)
break;
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
}
// - 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.
// Cleanup
// Generally you may always pass all inputs to dear imgui, and hide them from your application based on those two flags.
// 1. Show the big demo window (Most of the sample code is in ImGui::ShowDemoWindow()! You can browse its code to learn more about Dear ImGui!).
{
if(show_demo_window)
// Poll and handle events (inputs, window resize, etc.)
ImGui::ShowDemoWindow(&show_demo_window);
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// - 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.
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
// 3. Show another simple window.
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
show_another_window=false;
ImGui::End();
}
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
// Present Main Platform Window
ImGui::End();
if(!main_is_minimized)
FramePresent(wd);
}
}
// 3. Show another simple window.
// Cleanup
if(show_another_window)
err=vkDeviceWaitIdle(g_Device);
{
check_vk_result(err);
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
// 3. Show another simple window.
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
show_another_window=false;
ImGui::End();
}
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
//g_pSwapChain->Present(0, 0); // Present without vsync
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
// 3. Show another simple window.
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
show_another_window=false;
ImGui::End();
}
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
//g_pSwapChain->Present(0, 0); // Present without vsync
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
// 3. Show another simple window.
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
if(show_another_window)
{
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
show_another_window=false;
ImGui::End();
}
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
g_pSwapChain->Present(1,0);// Present with vsync
ImGui::End();
//g_pSwapChain->Present(0, 0); // Present without vsync
}
// 3. Show another simple window.
UINT64fenceValue=g_fenceLastSignaledValue+1;
if(show_another_window)
g_pd3dCommandQueue->Signal(g_fence,fenceValue);
{
g_fenceLastSignaledValue=fenceValue;
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::SliderFloat("float",&f,0.0f,1.0f);// Edit 1 float using a slider from 0.0f to 1.0f
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::ColorEdit3("clear color",(float*)&clear_color);// Edit 3 floats representing a color
ImGui::End();
}
if(ImGui::Button("Button"))// Buttons return true when clicked (most widgets return true when edited/activated)
// 3. Show another simple window.
counter++;
if(show_another_window)
ImGui::SameLine();
{
ImGui::Text("counter = %d",counter);
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
ImGui::Text("Hello from another window!");
if(ImGui::Button("Close Me"))
show_another_window=false;
ImGui::End();
}
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)",1000.0f/ImGui::GetIO().Framerate,ImGui::GetIO().Framerate);
ImGui::Begin("Another Window",&show_another_window);// Pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs, does that needs they could be moved to ImGuiTableTempData ?)
// Per-instance data that needs preserving across frames (seemingly most others do not need to be preserved aside from debug needs. Does that means they could be moved to ImGuiTableTempData?)
structImGuiTableInstanceData
structImGuiTableInstanceData
{
{
ImGuiIDTableInstanceID;
floatLastOuterHeight;// Outer height from last frame
floatLastOuterHeight;// Outer height from last frame
floatLastFirstRowHeight;// Height of first row from last frame (FIXME: this is used as "header height" and may be reworked)
floatLastFirstRowHeight;// Height of first row from last frame (FIXME: this is used as "header height" and may be reworked)
floatLastFrozenHeight;// Height of frozen section from last frame
floatLastFrozenHeight;// Height of frozen section from last frame