custom imgui window title!
This commit is contained in:
parent
e4cf3deecc
commit
3dbf4f2255
1 changed files with 15 additions and 7 deletions
|
@ -4,6 +4,8 @@
|
|||
#include <backends/imgui_impl_sdlrenderer.h>
|
||||
#include <SDL.h>
|
||||
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
@ -35,11 +37,6 @@ struct ControllerContext
|
|||
|
||||
void show_ui(ControllerContext *ctx)
|
||||
{
|
||||
const ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
ImGui::SetNextWindowPos(ImVec2(main_viewport->WorkPos.x + 20, main_viewport->WorkPos.y + 20), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(550, 340), ImGuiCond_FirstUseEver);
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar;
|
||||
|
||||
#ifndef IMGUI_DISABLE_DEBUG_TOOLS
|
||||
const bool has_debug_tools = true;
|
||||
#else
|
||||
|
@ -53,8 +50,19 @@ void show_ui(ControllerContext *ctx)
|
|||
if (show_app_debug_log)
|
||||
ImGui::ShowDebugLogWindow(&show_app_debug_log);
|
||||
|
||||
// Main body of the Demo window starts here.
|
||||
if (!ImGui::Begin("doompanning controls", nullptr, window_flags))
|
||||
const ImGuiViewport* main_viewport = ImGui::GetMainViewport();
|
||||
ImGui::SetNextWindowPos(ImVec2(main_viewport->WorkPos.x + 20, main_viewport->WorkPos.y + 20), ImGuiCond_FirstUseEver);
|
||||
ImGui::SetNextWindowSize(ImVec2(550, 340), ImGuiCond_FirstUseEver);
|
||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar;
|
||||
|
||||
auto &io = ImGui::GetIO();
|
||||
std::array<char, 1024> windowTitle;
|
||||
std::snprintf(windowTitle.data(), windowTitle.size(),
|
||||
"doompanning - #dooms=%zu, %.2f ms/frame (%.1f fps)###doompanning",
|
||||
0ul, 1000.0f / io.Framerate, io.Framerate);
|
||||
|
||||
// Main body of the doompanning window starts here.
|
||||
if (!ImGui::Begin(windowTitle.data(), nullptr, window_flags))
|
||||
{
|
||||
// Early out if the window is collapsed, as an optimization.
|
||||
ImGui::End();
|
||||
|
|
Loading…
Reference in a new issue