From 0f1b89eda96d728f1596f01b75540ec33b7c1077 Mon Sep 17 00:00:00 2001 From: dijunkun Date: Wed, 19 Jun 2024 17:33:44 +0800 Subject: [PATCH] Test tabbar in ImGui --- src/localization/localization.h | 13 +- src/multiple_windows/main_window.cpp | 465 ++++++++++++++------------- src/multiple_windows/main_window.h | 4 +- 3 files changed, 259 insertions(+), 223 deletions(-) diff --git a/src/localization/localization.h b/src/localization/localization.h index c0ed7da..4a339d9 100644 --- a/src/localization/localization.h +++ b/src/localization/localization.h @@ -10,6 +10,7 @@ #include namespace localization { +static std::vector tabbar = {u8"菜单", "Menu"}; static std::vector menu = {u8"菜单", "Menu"}; static std::vector local_id = {u8"本机ID", "Local ID"}; static std::vector password = {u8"密码", "Password"}; @@ -18,12 +19,12 @@ static std::vector max_password_len = {u8"最大6个字符", static std::vector remote_id = {u8"对端ID", "Remote ID"}; static std::vector connect = {u8"连接", "Connect"}; static std::vector disconnect = {u8"断开连接", "Disconnect"}; -static std::vector fullscreen = {u8"全屏", "Fullscreen"}; -static std::vector exit_fullscreen = {u8"退出全屏", - "Exit fullscreen"}; -static std::vector control_mouse = {u8"控制鼠标", "Mouse Control"}; -static std::vector release_mouse = {u8"释放鼠标", "Release Mouse"}; -static std::vector settings = {u8"设置", "Settings"}; +static std::vector fullscreen = {u8" 全屏", " Fullscreen"}; +static std::vector exit_fullscreen = {u8" 退出全屏", + " Exit fullscreen"}; +static std::vector control_mouse = {u8" 控制", " Control"}; +static std::vector release_mouse = {u8" 释放", " Release"}; +static std::vector settings = {u8" 设置", " Settings"}; static std::vector language = {u8"语言:", "Language:"}; static std::vector language_zh = {u8"中文", "Chinese"}; static std::vector language_en = {u8"英文", "English"}; diff --git a/src/multiple_windows/main_window.cpp b/src/multiple_windows/main_window.cpp index 411d2d4..e17d43f 100644 --- a/src/multiple_windows/main_window.cpp +++ b/src/multiple_windows/main_window.cpp @@ -185,7 +185,9 @@ int MainWindow::Run() { #endif // Create main window with SDL_Renderer graphics context - SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_ALLOW_HIGHDPI); + SDL_WindowFlags window_flags = + (SDL_WindowFlags)(SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_RESIZABLE | + SDL_WINDOW_BORDERLESS); main_window_ = SDL_CreateWindow("Remote Desk", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, main_window_width_, main_window_height_, window_flags); @@ -327,13 +329,30 @@ int MainWindow::Run() { ImGui_ImplSDL2_NewFrame(); ImGui::NewFrame(); + // tabbar + { + ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Always); + ImGui::Begin(localization::menu[localization_language_index_].c_str(), + nullptr, + ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | + ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar); + ImGui::PushStyleColor(ImGuiCol_Tab, ImVec4(0, 0, 0, 0.8)); + if (ImGui::BeginTabBar("TabBar1", ImGuiTabBarFlags_None)) { + ImGui::BeginTabItem( + localization::menu[localization_language_index_].c_str()); + ImGui::EndTabBar(); + ImGui::PopStyleColor(); + } + ImGui::End(); + } + // main window layout { ImGui::SetNextWindowPos(ImVec2(0, 0), ImGuiCond_Once); if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { ImGui::SetNextWindowSize( - ImVec2(MENU_WINDOW_WIDTH_CN, MENU_WINDOW_HEIGHT_CN)); + ImVec2(MENU_WINDOW_WIDTH_CN + 50, main_window_height_)); } else { ImGui::SetNextWindowSize( ImVec2(MENU_WINDOW_WIDTH_EN, MENU_WINDOW_HEIGHT_EN)); @@ -353,18 +372,26 @@ int MainWindow::Run() { nullptr, ImGuiWindowFlags_None); } - ImGui::Spacing(); - ImGui::Separator(); ImGui::Spacing(); { // local + ImGui::SetNextWindowSize(ImVec2(300, 180)); + ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 10.0f); + ImGui::SetNextWindowPos(ImVec2(0, 50), ImGuiCond_Always); + ImGui::Begin(u8"1", nullptr, + ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | + ImGuiWindowFlags_NoTitleBar); + { + ImGui::SetWindowFontScale(0.5f); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0, 0, 0, 0.3)); ImGui::Text( localization::local_id[localization_language_index_].c_str()); ImGui::PopStyleColor(); + ImGui::Spacing(); + ImGui::SetNextItemWidth(IPUT_WINDOW_WIDTH); ImGui::Spacing(); ImGui::SetWindowFontScale(1.0f); @@ -372,6 +399,12 @@ int MainWindow::Run() { mac_addr_str_.length() + 1, ImGuiInputTextFlags_CharsUppercase | ImGuiInputTextFlags_ReadOnly); + ImGui::Spacing(); + ImGui::Spacing(); + ImGui::Separator(); + ImGui::Spacing(); + ImGui::Spacing(); + ImGui::SetWindowFontScale(0.5f); ImGui::Text( localization::password[localization_language_index_].c_str()); @@ -425,6 +458,8 @@ int MainWindow::Run() { SaveSettingsIntoCacheFile(); } } + ImGui::End(); + ImGui::PopStyleVar(); } ImGui::Spacing(); @@ -432,8 +467,10 @@ int MainWindow::Run() { ImGui::Spacing(); ImGui::SetWindowFontScale(0.5f); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); // Mouse control - if (ImGui::Button(mouse_control_button_label_.c_str())) { + std::string mouse = ICON_FA_COMPUTER_MOUSE; + if (ImGui::Button(mouse.c_str(), ImVec2(25, 25))) { if (mouse_control_button_label_ == localization::control_mouse[localization_language_index_] && connection_established_) { @@ -451,7 +488,8 @@ int MainWindow::Run() { ImGui::SameLine(); // Fullscreen - if (ImGui::Button(fullscreen_button_label_.c_str())) { + std::string fullscreen = ICON_FA_EXPAND; + if (ImGui::Button(fullscreen.c_str(), ImVec2(25, 25))) { if (fullscreen_button_label_ == localization::fullscreen[localization_language_index_]) { main_window_width_before_fullscreen_ = main_window_width_; @@ -471,253 +509,250 @@ int MainWindow::Run() { fullscreen_button_pressed_ = !fullscreen_button_pressed_; } - ImGui::Spacing(); + ImGui::SameLine(); - ImGui::Separator(); + // std::string gear = ICON_FA_GEAR; + // if (ImGui::Button(gear.c_str(), ImVec2(25, 25))) { + // settings_button_pressed_ = !settings_button_pressed_; + // settings_window_pos_reset_ = true; + // } - ImGui::Spacing(); + // if (settings_button_pressed_) { + // if (settings_window_pos_reset_) { + // const ImGuiViewport *viewport = ImGui::GetMainViewport(); + // if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { + // ImGui::SetNextWindowPos( + // ImVec2((viewport->WorkSize.x - viewport->WorkPos.x - + // SETTINGS_WINDOW_WIDTH_CN) / + // 2, + // (viewport->WorkSize.y - viewport->WorkPos.y - + // SETTINGS_WINDOW_HEIGHT_CN) / + // 2)); - ImGui::SetWindowFontScale(0.5f); - std::string gear = ICON_FA_GEAR + settings_button_label_; - if (ImGui::Button(gear.c_str(), ImVec2(55, 25))) { - settings_button_pressed_ = !settings_button_pressed_; - settings_window_pos_reset_ = true; - } - ImGui::SetWindowFontScale(1.0f); + // ImGui::SetNextWindowSize( + // ImVec2(SETTINGS_WINDOW_WIDTH_CN, SETTINGS_WINDOW_HEIGHT_CN)); + // } else { + // ImGui::SetNextWindowPos( + // ImVec2((viewport->WorkSize.x - viewport->WorkPos.x - + // SETTINGS_WINDOW_WIDTH_EN) / + // 2, + // (viewport->WorkSize.y - viewport->WorkPos.y - + // SETTINGS_WINDOW_HEIGHT_EN) / + // 2)); - if (settings_button_pressed_) { - if (settings_window_pos_reset_) { - const ImGuiViewport *viewport = ImGui::GetMainViewport(); - if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { - ImGui::SetNextWindowPos( - ImVec2((viewport->WorkSize.x - viewport->WorkPos.x - - SETTINGS_WINDOW_WIDTH_CN) / - 2, - (viewport->WorkSize.y - viewport->WorkPos.y - - SETTINGS_WINDOW_HEIGHT_CN) / - 2)); + // ImGui::SetNextWindowSize( + // ImVec2(SETTINGS_WINDOW_WIDTH_EN, SETTINGS_WINDOW_HEIGHT_EN)); + // } - ImGui::SetNextWindowSize( - ImVec2(SETTINGS_WINDOW_WIDTH_CN, SETTINGS_WINDOW_HEIGHT_CN)); - } else { - ImGui::SetNextWindowPos( - ImVec2((viewport->WorkSize.x - viewport->WorkPos.x - - SETTINGS_WINDOW_WIDTH_EN) / - 2, - (viewport->WorkSize.y - viewport->WorkPos.y - - SETTINGS_WINDOW_HEIGHT_EN) / - 2)); + // settings_window_pos_reset_ = false; + // } - ImGui::SetNextWindowSize( - ImVec2(SETTINGS_WINDOW_WIDTH_EN, SETTINGS_WINDOW_HEIGHT_EN)); - } + // ImGui::SetWindowFontScale(0.5f); + // // Settings + // ImGui::Begin( + // localization::settings[localization_language_index_].c_str(), + // nullptr, + // ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | + // ImGuiWindowFlags_NoSavedSettings); + // ImGui::SetWindowFontScale(0.5f); + // { + // const char *language_items[] = { + // localization::language_zh[localization_language_index_].c_str(), + // localization::language_en[localization_language_index_].c_str()}; - settings_window_pos_reset_ = false; - } + // ImGui::SetCursorPosY(32); + // ImGui::Text( + // localization::language[localization_language_index_].c_str()); + // if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { + // ImGui::SetCursorPosX(LANGUAGE_SELECT_WINDOW_PADDING_CN); + // } else { + // ImGui::SetCursorPosX(LANGUAGE_SELECT_WINDOW_PADDING_EN); + // } + // ImGui::SetCursorPosY(30); + // ImGui::SetNextItemWidth(SETTINGS_SELECT_WINDOW_WIDTH); - ImGui::SetWindowFontScale(0.5f); - // Settings - ImGui::Begin( - localization::settings[localization_language_index_].c_str(), - nullptr, - ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | - ImGuiWindowFlags_NoSavedSettings); - ImGui::SetWindowFontScale(0.5f); - { - const char *language_items[] = { - localization::language_zh[localization_language_index_].c_str(), - localization::language_en[localization_language_index_].c_str()}; + // ImGui::Combo("##language", &language_button_value_, language_items, + // IM_ARRAYSIZE(language_items)); + // } - ImGui::SetCursorPosY(32); - ImGui::Text( - localization::language[localization_language_index_].c_str()); - if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { - ImGui::SetCursorPosX(LANGUAGE_SELECT_WINDOW_PADDING_CN); - } else { - ImGui::SetCursorPosX(LANGUAGE_SELECT_WINDOW_PADDING_EN); - } - ImGui::SetCursorPosY(30); - ImGui::SetNextItemWidth(SETTINGS_SELECT_WINDOW_WIDTH); + // ImGui::Separator(); - ImGui::Combo("##language", &language_button_value_, language_items, - IM_ARRAYSIZE(language_items)); - } + // { + // const char *video_quality_items[] = { + // localization::video_quality_high[localization_language_index_] + // .c_str(), + // localization::video_quality_medium[localization_language_index_] + // .c_str(), + // localization::video_quality_low[localization_language_index_] + // .c_str()}; - ImGui::Separator(); + // ImGui::SetCursorPosY(62); + // ImGui::Text(localization::video_quality[localization_language_index_] + // .c_str()); - { - const char *video_quality_items[] = { - localization::video_quality_high[localization_language_index_] - .c_str(), - localization::video_quality_medium[localization_language_index_] - .c_str(), - localization::video_quality_low[localization_language_index_] - .c_str()}; + // if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { + // ImGui::SetCursorPosX(VIDEO_QUALITY_SELECT_WINDOW_PADDING_CN); + // } else { + // ImGui::SetCursorPosX(VIDEO_QUALITY_SELECT_WINDOW_PADDING_EN); + // } + // ImGui::SetCursorPosY(60); + // ImGui::SetNextItemWidth(SETTINGS_SELECT_WINDOW_WIDTH); - ImGui::SetCursorPosY(62); - ImGui::Text(localization::video_quality[localization_language_index_] - .c_str()); + // ImGui::Combo("##video_quality", &video_quality_button_value_, + // video_quality_items, + // IM_ARRAYSIZE(video_quality_items)); + // } - if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { - ImGui::SetCursorPosX(VIDEO_QUALITY_SELECT_WINDOW_PADDING_CN); - } else { - ImGui::SetCursorPosX(VIDEO_QUALITY_SELECT_WINDOW_PADDING_EN); - } - ImGui::SetCursorPosY(60); - ImGui::SetNextItemWidth(SETTINGS_SELECT_WINDOW_WIDTH); + // ImGui::Separator(); - ImGui::Combo("##video_quality", &video_quality_button_value_, - video_quality_items, IM_ARRAYSIZE(video_quality_items)); - } + // { + // const char *video_encode_format_items[] = { + // localization::av1[localization_language_index_].c_str(), + // localization::h264[localization_language_index_].c_str()}; - ImGui::Separator(); + // ImGui::SetCursorPosY(92); + // ImGui::Text( + // localization::video_encode_format[localization_language_index_] + // .c_str()); - { - const char *video_encode_format_items[] = { - localization::av1[localization_language_index_].c_str(), - localization::h264[localization_language_index_].c_str()}; + // if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { + // ImGui::SetCursorPosX(VIDEO_ENCODE_FORMAT_SELECT_WINDOW_PADDING_CN); + // } else { + // ImGui::SetCursorPosX(VIDEO_ENCODE_FORMAT_SELECT_WINDOW_PADDING_EN); + // } + // ImGui::SetCursorPosY(90); + // ImGui::SetNextItemWidth(SETTINGS_SELECT_WINDOW_WIDTH); - ImGui::SetCursorPosY(92); - ImGui::Text( - localization::video_encode_format[localization_language_index_] - .c_str()); + // ImGui::Combo("##video_encode_format", + // &video_encode_format_button_value_, + // video_encode_format_items, + // IM_ARRAYSIZE(video_encode_format_items)); + // } - if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { - ImGui::SetCursorPosX(VIDEO_ENCODE_FORMAT_SELECT_WINDOW_PADDING_CN); - } else { - ImGui::SetCursorPosX(VIDEO_ENCODE_FORMAT_SELECT_WINDOW_PADDING_EN); - } - ImGui::SetCursorPosY(90); - ImGui::SetNextItemWidth(SETTINGS_SELECT_WINDOW_WIDTH); + // ImGui::Separator(); - ImGui::Combo("##video_encode_format", - &video_encode_format_button_value_, - video_encode_format_items, - IM_ARRAYSIZE(video_encode_format_items)); - } + // { + // ImGui::SetCursorPosY(122); + // ImGui::Text(localization::enable_hardware_video_codec + // [localization_language_index_] + // .c_str()); - ImGui::Separator(); + // if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { + // ImGui::SetCursorPosX( + // ENABLE_HARDWARE_VIDEO_CODEC_CHECKBOX_PADDING_CN); + // } else { + // ImGui::SetCursorPosX( + // ENABLE_HARDWARE_VIDEO_CODEC_CHECKBOX_PADDING_EN); + // } + // ImGui::SetCursorPosY(120); + // ImGui::Checkbox("##enable_hardware_video_codec", + // &enable_hardware_video_codec_); + // } - { - ImGui::SetCursorPosY(122); - ImGui::Text(localization::enable_hardware_video_codec - [localization_language_index_] - .c_str()); + // if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { + // ImGui::SetCursorPosX(SETTINGS_OK_BUTTON_PADDING_CN); + // } else { + // ImGui::SetCursorPosX(SETTINGS_OK_BUTTON_PADDING_EN); + // } + // ImGui::SetCursorPosY(160.0f); - if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { - ImGui::SetCursorPosX( - ENABLE_HARDWARE_VIDEO_CODEC_CHECKBOX_PADDING_CN); - } else { - ImGui::SetCursorPosX( - ENABLE_HARDWARE_VIDEO_CODEC_CHECKBOX_PADDING_EN); - } - ImGui::SetCursorPosY(120); - ImGui::Checkbox("##enable_hardware_video_codec", - &enable_hardware_video_codec_); - } + // // OK + // if (ImGui::Button( + // localization::ok[localization_language_index_].c_str())) { + // settings_button_pressed_ = false; - if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { - ImGui::SetCursorPosX(SETTINGS_OK_BUTTON_PADDING_CN); - } else { - ImGui::SetCursorPosX(SETTINGS_OK_BUTTON_PADDING_EN); - } - ImGui::SetCursorPosY(160.0f); + // // Language + // if (language_button_value_ == 0) { + // config_center_.SetLanguage(ConfigCenter::LANGUAGE::CHINESE); + // } else { + // config_center_.SetLanguage(ConfigCenter::LANGUAGE::ENGLISH); + // } + // language_button_value_last_ = language_button_value_; + // localization_language_ = + // (ConfigCenter::LANGUAGE)language_button_value_; + // localization_language_index_ = language_button_value_; + // LOG_INFO("Set localization language: {}", + // localization_language_index_ == 0 ? "zh" : "en"); - // OK - if (ImGui::Button( - localization::ok[localization_language_index_].c_str())) { - settings_button_pressed_ = false; + // // Video quality + // if (video_quality_button_value_ == 0) { + // config_center_.SetVideoQuality(ConfigCenter::VIDEO_QUALITY::HIGH); + // } else if (video_quality_button_value_ == 1) { + // config_center_.SetVideoQuality(ConfigCenter::VIDEO_QUALITY::MEDIUM); + // } else { + // config_center_.SetVideoQuality(ConfigCenter::VIDEO_QUALITY::LOW); + // } + // video_quality_button_value_last_ = video_quality_button_value_; - // Language - if (language_button_value_ == 0) { - config_center_.SetLanguage(ConfigCenter::LANGUAGE::CHINESE); - } else { - config_center_.SetLanguage(ConfigCenter::LANGUAGE::ENGLISH); - } - language_button_value_last_ = language_button_value_; - localization_language_ = - (ConfigCenter::LANGUAGE)language_button_value_; - localization_language_index_ = language_button_value_; - LOG_INFO("Set localization language: {}", - localization_language_index_ == 0 ? "zh" : "en"); + // // Video encode format + // if (video_encode_format_button_value_ == 0) { + // config_center_.SetVideoEncodeFormat( + // ConfigCenter::VIDEO_ENCODE_FORMAT::AV1); + // } else if (video_encode_format_button_value_ == 1) { + // config_center_.SetVideoEncodeFormat( + // ConfigCenter::VIDEO_ENCODE_FORMAT::H264); + // } + // video_encode_format_button_value_last_ = + // video_encode_format_button_value_; - // Video quality - if (video_quality_button_value_ == 0) { - config_center_.SetVideoQuality(ConfigCenter::VIDEO_QUALITY::HIGH); - } else if (video_quality_button_value_ == 1) { - config_center_.SetVideoQuality(ConfigCenter::VIDEO_QUALITY::MEDIUM); - } else { - config_center_.SetVideoQuality(ConfigCenter::VIDEO_QUALITY::LOW); - } - video_quality_button_value_last_ = video_quality_button_value_; + // // Hardware video codec + // if (enable_hardware_video_codec_) { + // config_center_.SetHardwareVideoCodec(true); + // } else { + // config_center_.SetHardwareVideoCodec(false); + // } + // enable_hardware_video_codec_last_ = enable_hardware_video_codec_; - // Video encode format - if (video_encode_format_button_value_ == 0) { - config_center_.SetVideoEncodeFormat( - ConfigCenter::VIDEO_ENCODE_FORMAT::AV1); - } else if (video_encode_format_button_value_ == 1) { - config_center_.SetVideoEncodeFormat( - ConfigCenter::VIDEO_ENCODE_FORMAT::H264); - } - video_encode_format_button_value_last_ = - video_encode_format_button_value_; + // SaveSettingsIntoCacheFile(); + // settings_window_pos_reset_ = true; - // Hardware video codec - if (enable_hardware_video_codec_) { - config_center_.SetHardwareVideoCodec(true); - } else { - config_center_.SetHardwareVideoCodec(false); - } - enable_hardware_video_codec_last_ = enable_hardware_video_codec_; + // // Recreate peer instance + // LoadSettingsIntoCacheFile(); - SaveSettingsIntoCacheFile(); - settings_window_pos_reset_ = true; + // // Recreate peer instance + // { + // DestroyPeer(peer_); + // CreateConnectionPeer(); + // LOG_INFO("Recreate peer instance successful"); + // } + // } + // ImGui::SameLine(); + // // Cancel + // if (ImGui::Button( + // localization::cancel[localization_language_index_].c_str())) + // { + // settings_button_pressed_ = false; + // if (language_button_value_ != language_button_value_last_) { + // language_button_value_ = language_button_value_last_; + // } - // Recreate peer instance - LoadSettingsIntoCacheFile(); + // if (video_quality_button_value_ != + // video_quality_button_value_last_) { + // video_quality_button_value_ = video_quality_button_value_last_; + // } - // Recreate peer instance - { - DestroyPeer(peer_); - CreateConnectionPeer(); - LOG_INFO("Recreate peer instance successful"); - } - } - ImGui::SameLine(); - // Cancel - if (ImGui::Button( - localization::cancel[localization_language_index_].c_str())) { - settings_button_pressed_ = false; - if (language_button_value_ != language_button_value_last_) { - language_button_value_ = language_button_value_last_; - } + // if (video_encode_format_button_value_ != + // video_encode_format_button_value_last_) { + // video_encode_format_button_value_ = + // video_encode_format_button_value_last_; + // } - if (video_quality_button_value_ != video_quality_button_value_last_) { - video_quality_button_value_ = video_quality_button_value_last_; - } + // if (enable_hardware_video_codec_ != + // enable_hardware_video_codec_last_) { + // enable_hardware_video_codec_ = enable_hardware_video_codec_last_; + // } - if (video_encode_format_button_value_ != - video_encode_format_button_value_last_) { - video_encode_format_button_value_ = - video_encode_format_button_value_last_; - } + // settings_window_pos_reset_ = true; + // } - if (enable_hardware_video_codec_ != - enable_hardware_video_codec_last_) { - enable_hardware_video_codec_ = enable_hardware_video_codec_last_; - } - - settings_window_pos_reset_ = true; - } - - ImGui::End(); - } + // ImGui::End(); + // } ImGui::End(); } { - ImGui::SetNextWindowPos(ImVec2(MENU_WINDOW_WIDTH_CN, 0), + ImGui::SetNextWindowPos(ImVec2(MENU_WINDOW_WIDTH_CN + 200, 30), ImGuiCond_Always); if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) { ImGui::SetNextWindowSize( @@ -859,8 +894,8 @@ int MainWindow::Run() { main_window_width_ = main_window_height_ * 16 / 9; } - SDL_SetWindowSize(main_window_, main_window_width_, - main_window_height_); + // SDL_SetWindowSize(main_window_, main_window_width_, + // main_window_height_); } else if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_CLOSE && event.window.windowID == SDL_GetWindowID(main_window_)) { diff --git a/src/multiple_windows/main_window.h b/src/multiple_windows/main_window.h index f169baf..9d35d93 100644 --- a/src/multiple_windows/main_window.h +++ b/src/multiple_windows/main_window.h @@ -101,8 +101,8 @@ class MainWindow { private: int screen_width_ = 1280; int screen_height_ = 720; - int main_window_width_ = 640; - int main_window_height_ = 360; + int main_window_width_ = 1280; + int main_window_height_ = 720; int main_window_width_before_fullscreen_ = 1280; int main_window_height_before_fullscreen_ = 720;