// 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.)
// Emscripten Build
// You can read the io.WantCaptureMouse, io.WantCaptureKeyboard flags to tell if dear imgui wants to use your inputs.
// For an Emscripten build we are disabling file-system access, so let's not attempt to do a fopen() of the imgui.ini file.
// - When io.WantCaptureMouse is true, do not dispatch mouse input data to your main application, or clear/overwrite your copy of the mouse data.
// You may manually call LoadIniSettingsFromMemory() to load settings from your own storage.
// - When io.WantCaptureKeyboard is true, do not dispatch keyboard input data to your main application, or clear/overwrite your copy of the keyboard data.
io.IniFilename=NULL;
// 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.
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*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 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)
ImGui::ShowDemoWindow(&show_demo_window);
boolMainLoopStep()
// 2. Show a simple window that we create ourselves. We use a Begin/End pair to create a named window.
{
// 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
// 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.
// Cleanup
if(show_another_window)
ImGui_ImplDX11_Shutdown();
{
ImGui_ImplSDL2_Shutdown();
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.)
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.)
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.)
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::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*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)
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);
//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.
// Cleanup
if(show_another_window)
ImGui_ImplDX11_Shutdown();
{
ImGui_ImplWin32_Shutdown();
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);
//g_pSwapChain->Present(0, 0); // Present without vsync
UINT64fenceValue=g_fenceLastSignaledValue+1;
g_pd3dCommandQueue->Signal(g_fence,fenceValue);
g_fenceLastSignaledValue=fenceValue;
frameCtx->FenceValue=fenceValue;
}
}
// 3. Show another simple window.
WaitForLastSubmittedFrame();
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::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)