summaryrefslogtreecommitdiffstats
path: root/src/core/frontend/emu_window.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-01-10 04:36:07 +0100
committerbunnei <bunneidev@gmail.com>2018-01-11 05:28:43 +0100
commit482cf8a005a3c13ac7239995fdbe2e78d12984b9 (patch)
tree0e29fe56ada3a97a1f753ad68e1430e98f66e303 /src/core/frontend/emu_window.cpp
parentNV: Move the nv device nodes to their own directory and namespace. (diff)
downloadyuzu-482cf8a005a3c13ac7239995fdbe2e78d12984b9.tar
yuzu-482cf8a005a3c13ac7239995fdbe2e78d12984b9.tar.gz
yuzu-482cf8a005a3c13ac7239995fdbe2e78d12984b9.tar.bz2
yuzu-482cf8a005a3c13ac7239995fdbe2e78d12984b9.tar.lz
yuzu-482cf8a005a3c13ac7239995fdbe2e78d12984b9.tar.xz
yuzu-482cf8a005a3c13ac7239995fdbe2e78d12984b9.tar.zst
yuzu-482cf8a005a3c13ac7239995fdbe2e78d12984b9.zip
Diffstat (limited to '')
-rw-r--r--src/core/frontend/emu_window.cpp48
1 files changed, 13 insertions, 35 deletions
diff --git a/src/core/frontend/emu_window.cpp b/src/core/frontend/emu_window.cpp
index e67394177..2d776c693 100644
--- a/src/core/frontend/emu_window.cpp
+++ b/src/core/frontend/emu_window.cpp
@@ -41,7 +41,8 @@ private:
EmuWindow::EmuWindow() {
// 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(Layout::ScreenUndocked::Width, Layout::ScreenUndocked::Height);
active_config = config;
touch_state = std::make_shared<TouchState>();
Input::RegisterFactory<Input::TouchDevice>("emu_window", touch_state);
@@ -60,17 +61,16 @@ EmuWindow::~EmuWindow() {
*/
static bool IsWithinTouchscreen(const Layout::FramebufferLayout& layout, unsigned framebuffer_x,
unsigned framebuffer_y) {
- return (
- framebuffer_y >= layout.bottom_screen.top && framebuffer_y < layout.bottom_screen.bottom &&
- framebuffer_x >= layout.bottom_screen.left && framebuffer_x < layout.bottom_screen.right);
+ return (framebuffer_y >= layout.screen.top && framebuffer_y < layout.screen.bottom &&
+ framebuffer_x >= layout.screen.left && framebuffer_x < layout.screen.right);
}
std::tuple<unsigned, unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) {
- new_x = std::max(new_x, framebuffer_layout.bottom_screen.left);
- new_x = std::min(new_x, framebuffer_layout.bottom_screen.right - 1);
+ new_x = std::max(new_x, framebuffer_layout.screen.left);
+ new_x = std::min(new_x, framebuffer_layout.screen.right - 1);
- new_y = std::max(new_y, framebuffer_layout.bottom_screen.top);
- new_y = std::min(new_y, framebuffer_layout.bottom_screen.bottom - 1);
+ new_y = std::max(new_y, framebuffer_layout.screen.top);
+ new_y = std::min(new_y, framebuffer_layout.screen.bottom - 1);
return std::make_tuple(new_x, new_y);
}
@@ -80,12 +80,10 @@ void EmuWindow::TouchPressed(unsigned framebuffer_x, unsigned framebuffer_y) {
return;
std::lock_guard<std::mutex> guard(touch_state->mutex);
- touch_state->touch_x =
- static_cast<float>(framebuffer_x - framebuffer_layout.bottom_screen.left) /
- (framebuffer_layout.bottom_screen.right - framebuffer_layout.bottom_screen.left);
- touch_state->touch_y =
- static_cast<float>(framebuffer_y - framebuffer_layout.bottom_screen.top) /
- (framebuffer_layout.bottom_screen.bottom - framebuffer_layout.bottom_screen.top);
+ touch_state->touch_x = static_cast<float>(framebuffer_x - framebuffer_layout.screen.left) /
+ (framebuffer_layout.screen.right - framebuffer_layout.screen.left);
+ touch_state->touch_y = static_cast<float>(framebuffer_y - framebuffer_layout.screen.top) /
+ (framebuffer_layout.screen.bottom - framebuffer_layout.screen.top);
touch_state->touch_pressed = true;
}
@@ -108,25 +106,5 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
}
void EmuWindow::UpdateCurrentFramebufferLayout(unsigned width, unsigned height) {
- Layout::FramebufferLayout layout;
- if (Settings::values.custom_layout == true) {
- layout = Layout::CustomFrameLayout(width, height);
- } else {
- switch (Settings::values.layout_option) {
- case Settings::LayoutOption::SingleScreen:
- layout = Layout::SingleFrameLayout(width, height, Settings::values.swap_screen);
- break;
- case Settings::LayoutOption::LargeScreen:
- layout = Layout::LargeFrameLayout(width, height, Settings::values.swap_screen);
- break;
- case Settings::LayoutOption::SideScreen:
- layout = Layout::SideFrameLayout(width, height, Settings::values.swap_screen);
- break;
- case Settings::LayoutOption::Default:
- default:
- layout = Layout::DefaultFrameLayout(width, height, Settings::values.swap_screen);
- break;
- }
- }
- NotifyFramebufferLayoutChanged(layout);
+ NotifyFramebufferLayoutChanged(Layout::DefaultFrameLayout(width, height));
}