From 6ab731648b43a78bcb0380b9bbdc7ae6e4f99acc Mon Sep 17 00:00:00 2001 From: Anon Date: Sat, 30 Jul 2016 10:24:27 -0500 Subject: [PATCH] cleanup --- src/common/emu_window.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/common/emu_window.cpp b/src/common/emu_window.cpp index f462d42e1..a3bab3961 100644 --- a/src/common/emu_window.cpp +++ b/src/common/emu_window.cpp @@ -21,8 +21,8 @@ void EmuWindow::ButtonReleased(Service::HID::PadState pad) { void EmuWindow::CirclePadUpdated(float x, float y) { constexpr int MAX_CIRCLEPAD_POS = 0x9C; // Max value for a circle pad position - // Make sure the coordinates are in the unit circle, - // otherwise normalize it. + // Make sure the coordinates are in the unit circle, + // otherwise normalize it. float r = x * x + y * y; if (r > 1) { r = std::sqrt(r); @@ -35,26 +35,26 @@ void EmuWindow::CirclePadUpdated(float x, float y) { } /** -* Check if the given x/y coordinates are within the touchpad specified by the framebuffer layout -* @param layout FramebufferLayout object describing the framebuffer size and screen positions -* @param framebuffer_x Framebuffer x-coordinate to check -* @param framebuffer_y Framebuffer y-coordinate to check -* @return True if the coordinates are within the touchpad, otherwise false -*/ + * Check if the given x/y coordinates are within the touchpad specified by the framebuffer layout + * @param layout FramebufferLayout object describing the framebuffer size and screen positions + * @param framebuffer_x Framebuffer x-coordinate to check + * @param framebuffer_y Framebuffer y-coordinate to check + * @return True if the coordinates are within the touchpad, otherwise false + */ static bool IsWithinTouchscreen(const EmuWindow::FramebufferLayout& layout, unsigned framebuffer_x, - unsigned framebuffer_y) { + 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); + framebuffer_y < layout.bottom_screen.bottom && + framebuffer_x >= layout.bottom_screen.left && + framebuffer_x < layout.bottom_screen.right); } -std::tuple EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) { +std::tuple 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::min(new_x, framebuffer_layout.bottom_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::min(new_y, framebuffer_layout.bottom_screen.bottom-1); return std::make_tuple(new_x, new_y); } @@ -94,7 +94,7 @@ EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(u if (width == 0) width = 1; if (height == 0) height = 1; - EmuWindow::FramebufferLayout res = { width, height,{},{} }; + EmuWindow::FramebufferLayout res = { width, height, {}, {} }; float window_aspect_ratio = static_cast(height) / width; float emulation_aspect_ratio = static_cast(VideoCore::kScreenTopHeight * 2) / @@ -117,8 +117,7 @@ EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(u res.bottom_screen.right = res.bottom_screen.left + bottom_width; res.bottom_screen.top = res.top_screen.bottom; res.bottom_screen.bottom = res.bottom_screen.top + viewport_height / 2; - } - else { + } else { // Otherwise, apply borders to the left and right sides of the window. int viewport_width = static_cast(std::round(height / emulation_aspect_ratio));