Test tabbar in ImGui

This commit is contained in:
dijunkun
2024-06-19 17:33:44 +08:00
parent 172b8836fd
commit 0f1b89eda9
3 changed files with 259 additions and 223 deletions

View File

@@ -10,6 +10,7 @@
#include <vector>
namespace localization {
static std::vector<std::string> tabbar = {u8"菜单", "Menu"};
static std::vector<std::string> menu = {u8"菜单", "Menu"};
static std::vector<std::string> local_id = {u8"本机ID", "Local ID"};
static std::vector<std::string> password = {u8"密码", "Password"};
@@ -18,12 +19,12 @@ static std::vector<std::string> max_password_len = {u8"最大6个字符",
static std::vector<std::string> remote_id = {u8"对端ID", "Remote ID"};
static std::vector<std::string> connect = {u8"连接", "Connect"};
static std::vector<std::string> disconnect = {u8"断开连接", "Disconnect"};
static std::vector<std::string> fullscreen = {u8"全屏", "Fullscreen"};
static std::vector<std::string> exit_fullscreen = {u8"退出全屏",
"Exit fullscreen"};
static std::vector<std::string> control_mouse = {u8"控制鼠标", "Mouse Control"};
static std::vector<std::string> release_mouse = {u8"释放鼠标", "Release Mouse"};
static std::vector<std::string> settings = {u8"设置", "Settings"};
static std::vector<std::string> fullscreen = {u8" 全屏", " Fullscreen"};
static std::vector<std::string> exit_fullscreen = {u8" 退出全屏",
" Exit fullscreen"};
static std::vector<std::string> control_mouse = {u8" 控制", " Control"};
static std::vector<std::string> release_mouse = {u8" 释放", " Release"};
static std::vector<std::string> settings = {u8" 设置", " Settings"};
static std::vector<std::string> language = {u8"语言:", "Language:"};
static std::vector<std::string> language_zh = {u8"中文", "Chinese"};
static std::vector<std::string> language_en = {u8"英文", "English"};

View File

@@ -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"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>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::Separator();
ImGui::Spacing();
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);
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_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));
ImGui::SetNextWindowSize(
ImVec2(SETTINGS_WINDOW_WIDTH_EN, SETTINGS_WINDOW_HEIGHT_EN));
}
settings_window_pos_reset_ = false;
}
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::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::Combo("##language", &language_button_value_, language_items,
IM_ARRAYSIZE(language_items));
}
ImGui::Separator();
{
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::SetCursorPosY(62);
ImGui::Text(localization::video_quality[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::Combo("##video_quality", &video_quality_button_value_,
video_quality_items, IM_ARRAYSIZE(video_quality_items));
}
ImGui::Separator();
{
const char *video_encode_format_items[] = {
localization::av1[localization_language_index_].c_str(),
localization::h264[localization_language_index_].c_str()};
ImGui::SetCursorPosY(92);
ImGui::Text(
localization::video_encode_format[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::Combo("##video_encode_format",
&video_encode_format_button_value_,
video_encode_format_items,
IM_ARRAYSIZE(video_encode_format_items));
}
ImGui::Separator();
{
ImGui::SetCursorPosY(122);
ImGui::Text(localization::enable_hardware_video_codec
[localization_language_index_]
.c_str());
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_);
}
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);
// OK
if (ImGui::Button(
localization::ok[localization_language_index_].c_str())) {
settings_button_pressed_ = false;
// 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 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_;
// 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_;
// 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_;
SaveSettingsIntoCacheFile();
settings_window_pos_reset_ = true;
// Recreate peer instance
LoadSettingsIntoCacheFile();
// 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_quality_button_value_ != video_quality_button_value_last_) {
video_quality_button_value_ = video_quality_button_value_last_;
}
// 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;
// }
if (video_encode_format_button_value_ !=
video_encode_format_button_value_last_) {
video_encode_format_button_value_ =
video_encode_format_button_value_last_;
}
// 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));
if (enable_hardware_video_codec_ !=
enable_hardware_video_codec_last_) {
enable_hardware_video_codec_ = enable_hardware_video_codec_last_;
}
// 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_ = true;
}
// ImGui::SetNextWindowSize(
// ImVec2(SETTINGS_WINDOW_WIDTH_EN, SETTINGS_WINDOW_HEIGHT_EN));
// }
ImGui::End();
}
// settings_window_pos_reset_ = false;
// }
// 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::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::Combo("##language", &language_button_value_, language_items,
// IM_ARRAYSIZE(language_items));
// }
// ImGui::Separator();
// {
// 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::SetCursorPosY(62);
// ImGui::Text(localization::video_quality[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::Combo("##video_quality", &video_quality_button_value_,
// video_quality_items,
// IM_ARRAYSIZE(video_quality_items));
// }
// ImGui::Separator();
// {
// const char *video_encode_format_items[] = {
// localization::av1[localization_language_index_].c_str(),
// localization::h264[localization_language_index_].c_str()};
// ImGui::SetCursorPosY(92);
// ImGui::Text(
// localization::video_encode_format[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::Combo("##video_encode_format",
// &video_encode_format_button_value_,
// video_encode_format_items,
// IM_ARRAYSIZE(video_encode_format_items));
// }
// ImGui::Separator();
// {
// ImGui::SetCursorPosY(122);
// ImGui::Text(localization::enable_hardware_video_codec
// [localization_language_index_]
// .c_str());
// 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_);
// }
// 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);
// // OK
// if (ImGui::Button(
// localization::ok[localization_language_index_].c_str())) {
// settings_button_pressed_ = false;
// // 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 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_;
// // 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_;
// // 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_;
// SaveSettingsIntoCacheFile();
// settings_window_pos_reset_ = true;
// // Recreate peer instance
// LoadSettingsIntoCacheFile();
// // 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_quality_button_value_ !=
// video_quality_button_value_last_) {
// video_quality_button_value_ = video_quality_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 (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::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_)) {

View File

@@ -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;