[fix] fix imgui layout error

This commit is contained in:
dijunkun
2024-11-01 15:57:15 +08:00
parent d18af6cbc6
commit 26fa53f867
4 changed files with 34 additions and 20 deletions

View File

@@ -302,7 +302,6 @@ int Render::LocalWindow() {
} }
ImGui::EndChild(); ImGui::EndChild();
ImGui::PopStyleVar();
} }
ImGui::EndChild(); ImGui::EndChild();

View File

@@ -518,8 +518,23 @@ int Render::Run() {
ImGui::PopStyleColor(); ImGui::PopStyleColor();
TitleBar(); TitleBar();
if (connection_established_ && streaming_ && is_client_mode_) {
if (!resizable_) {
resizable_ = !resizable_;
SDL_SetWindowResizable(main_window_, SDL_TRUE);
}
ControlWindow();
} else {
if (resizable_) {
resizable_ = !resizable_;
SDL_SetWindowResizable(main_window_, SDL_FALSE);
}
MainWindow();
} }
ImGui::End();
} else {
if (connection_established_ && streaming_ && is_client_mode_) { if (connection_established_ && streaming_ && is_client_mode_) {
if (!resizable_) { if (!resizable_) {
resizable_ = !resizable_; resizable_ = !resizable_;
@@ -534,9 +549,6 @@ int Render::Run() {
} }
MainWindow(); MainWindow();
} }
if (!fullscreen_button_pressed_) {
ImGui::End();
} }
// create connection // create connection

View File

@@ -48,7 +48,6 @@ int Render::TitleBar() {
draw_list->AddLine(ImVec2(bar_pos_x, bar_pos_y + 6), draw_list->AddLine(ImVec2(bar_pos_x, bar_pos_y + 6),
ImVec2(bar_pos_x + menu_bar_line_size, bar_pos_y + 6), ImVec2(bar_pos_x + menu_bar_line_size, bar_pos_y + 6),
IM_COL32(0, 0, 0, 255)); IM_COL32(0, 0, 0, 255));
ImGui::PopStyleColor(2);
{ {
SettingWindow(); SettingWindow();
@@ -56,6 +55,8 @@ int Render::TitleBar() {
} }
} }
ImGui::PopStyleColor(2);
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0));
ImGui::SetCursorPosX(main_window_width_ - (streaming_ ImGui::SetCursorPosX(main_window_width_ - (streaming_
? BUTTON_PADDING * 3 ? BUTTON_PADDING * 3
@@ -146,11 +147,13 @@ int Render::TitleBar() {
ImGui::PopStyleColor(2); ImGui::PopStyleColor(2);
ImGui::PopStyleColor(1); ImGui::PopStyleColor();
} }
ImGui::EndMenuBar();
ImGui::SetWindowFontScale(1.0f); ImGui::SetWindowFontScale(1.0f);
ImGui::EndChild(); ImGui::EndChild();
ImGui::PopStyleColor(2); ImGui::PopStyleColor();
return 0; return 0;
} }

View File

@@ -17,7 +17,7 @@ if is_mode("debug") then
end end
add_requires("spdlog 1.14.1", {system = false}) add_requires("spdlog 1.14.1", {system = false})
add_requires("imgui v1.91.0", {configs = {sdl2 = true, sdl2_renderer = true}}) add_requires("imgui v1.91.4-docking", {configs = {sdl2 = true, sdl2_renderer = true}})
add_requires("miniaudio 0.11.21") add_requires("miniaudio 0.11.21")
if is_os("windows") then if is_os("windows") then