Make control bar scrollable

This commit is contained in:
dijunkun
2024-07-05 16:05:50 +08:00
parent 872152f1be
commit 9702805331
6 changed files with 82 additions and 45 deletions

View File

@@ -1,16 +1,31 @@
#include "render.h"
int Render::ControlWindow() {
ImGui::PushStyleColor(ImGuiCol_MenuBarBg, ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
static bool a, b, c, d, e;
ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always);
ImGui::SetWindowFontScale(0.5f);
auto time_duration = ImGui::GetTime() - control_bar_button_pressed_time_;
auto control_window_width =
!control_bar_button_pressed_
? time_duration < 0.25f
? main_window_width_ -
(main_window_width_ - control_window_min_width_) * 4 *
time_duration
: control_window_min_width_
: time_duration < 0.25f
? control_window_min_width_ +
(main_window_width_ - control_window_min_width_) * 4 *
time_duration
: main_window_width_;
ImGui::BeginChild("ControlWindow",
ImVec2(main_window_width_, menu_window_height_),
ImGuiChildFlags_Border, ImGuiWindowFlags_NoScrollbar);
ImVec2(control_window_width, control_window_height_),
ImGuiChildFlags_Border, ImGuiWindowFlags_NoDecoration);
ImGui::SetWindowFontScale(1.0f);
ControlBar();
ImGui::SetWindowFontScale(1.0f);
ImGui::PopStyleColor();
ImGui::EndChild();