Skip to content

Commit

Permalink
ui: improve imgui windows and allow dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryp committed Mar 19, 2024
1 parent ff717b3 commit 8875124
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
10 changes: 4 additions & 6 deletions src/GameLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,11 @@ namespace
{
static bool show_window = true;

const float pad = 100.0f;
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
//
ImGui::SetNextWindowPos(ImVec2(work_pos.x + pad, work_pos.y + pad), ImGuiCond_Always);
ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background
ImGui::SetNextWindowPos(ImVec2(work_pos.x + 300.f, work_pos.y), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background

if (ImGui::Begin("Controller Axes", &show_window))
{
Expand Down Expand Up @@ -748,12 +747,11 @@ void execute_game_loop(ReaperRoot& root)
constexpr u32 length_max = 100;

static bool show_window = true;
const float pad = 100.0f;
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
//
ImGui::SetNextWindowPos(ImVec2(work_pos.x + pad, work_pos.y + pad), ImGuiCond_Always);
ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background
ImGui::SetNextWindowPos(ImVec2(work_pos.x, work_pos.y + 300.f), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background

if (ImGui::Begin("Physics", &show_window))
{
Expand Down
15 changes: 5 additions & 10 deletions src/renderer/vulkan/renderpass/TestGraphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,13 @@ void backend_debug_ui(VulkanBackend& backend)
{
static bool show_app_simple_overlay = true;

ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize
| ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing
| ImGuiWindowFlags_NoNav;

const float pad = 10.0f;
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImVec2 work_pos = viewport->WorkPos; // Use work area to avoid menu-bar/task-bar, if any!
ImGui::SetNextWindowPos(ImVec2(work_pos.x + pad, work_pos.y + pad), ImGuiCond_Always);
window_flags |= ImGuiWindowFlags_NoMove;
ImVec2 work_pos = viewport->WorkPos;

ImGui::SetNextWindowPos(ImVec2(work_pos.x + 10.f, work_pos.y + 10.f), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowBgAlpha(0.35f);

ImGui::SetNextWindowBgAlpha(0.35f); // Transparent background
if (ImGui::Begin("Example: Simple overlay", &show_app_simple_overlay, window_flags))
if (ImGui::Begin("Rendering", &show_app_simple_overlay))
{
ImGui::Checkbox("Freeze culling [BROKEN]", &backend.options.freeze_meshlet_culling); // FIXME
ImGui::Checkbox("Enable debug tile culling", &backend.options.enable_debug_tile_lighting);
Expand Down

0 comments on commit 8875124

Please sign in to comment.