1
0
Fork 0

use the defined constants instead of magic numbers for screen dimensions

This commit is contained in:
Vitor Kiguchi 2020-01-18 18:57:13 -03:00
parent 64737afdbc
commit 6e1a873e57
1 changed files with 10 additions and 9 deletions

View File

@ -4,6 +4,7 @@
#include <cmath> #include <cmath>
#include <mutex> #include <mutex>
#include "core/3ds.h"
#include "core/frontend/emu_window.h" #include "core/frontend/emu_window.h"
#include "core/frontend/input.h" #include "core/frontend/input.h"
#include "core/settings.h" #include "core/settings.h"
@ -45,7 +46,7 @@ private:
EmuWindow::EmuWindow() { EmuWindow::EmuWindow() {
// TODO: Find a better place to set this. // TODO: Find a better place to set this.
config.min_client_area_size = std::make_pair(400u, 480u); config.min_client_area_size = std::make_pair(Core::kScreenTopWidth, Core::kScreenTopHeight + Core::kScreenBottomHeight);
active_config = config; active_config = config;
touch_state = std::make_shared<TouchState>(); touch_state = std::make_shared<TouchState>();
Input::RegisterFactory<Input::TouchDevice>("emu_window", touch_state); Input::RegisterFactory<Input::TouchDevice>("emu_window", touch_state);
@ -153,27 +154,27 @@ void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height)
case Settings::LayoutOption::SingleScreen: case Settings::LayoutOption::SingleScreen:
layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen, layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen,
Settings::values.upright_screen); Settings::values.upright_screen);
min_width = Settings::values.swap_screen ? 320u : 400u; min_width = Settings::values.swap_screen ? Core::kScreenBottomWidth : Core::kScreenTopWidth;
min_height = 240u; min_height = Core::kScreenBottomHeight;
break; break;
case Settings::LayoutOption::LargeScreen: case Settings::LayoutOption::LargeScreen:
layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen, layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen,
Settings::values.upright_screen); Settings::values.upright_screen);
min_width = Settings::values.swap_screen ? 420u : 480u; min_width = Settings::values.swap_screen ? Core::kScreenTopWidth/4 + Core::kScreenBottomWidth : Core::kScreenTopWidth + Core::kScreenBottomWidth/4;
min_height = 240u; min_height = Core::kScreenBottomHeight;
break; break;
case Settings::LayoutOption::SideScreen: case Settings::LayoutOption::SideScreen:
layout = Layout::SideFrameLayout(width, height, Settings::values.swap_screen, layout = Layout::SideFrameLayout(width, height, Settings::values.swap_screen,
Settings::values.upright_screen); Settings::values.upright_screen);
min_width = 720u; min_width = Core::kScreenTopWidth + Core::kScreenBottomWidth;
min_height = 240u; min_height = Core::kScreenBottomHeight;
break; break;
case Settings::LayoutOption::Default: case Settings::LayoutOption::Default:
default: default:
layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen, layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen,
Settings::values.upright_screen); Settings::values.upright_screen);
min_width = 400u; min_width = Core::kScreenTopWidth;
min_height = 480u; min_height = Core::kScreenTopHeight + Core::kScreenBottomHeight;
break; break;
} }
if(Settings::values.upright_screen){ if(Settings::values.upright_screen){