mirror of
https://github.com/yuzu-mirror/yuzu
synced 2024-12-20 11:43:06 +00:00
emu_window: Return pair from ClipToTouchScreen() instead of tuple
This is only a 2-tuple, so it can be converted over to the std::pair class.
This commit is contained in:
parent
8805233f5e
commit
d363b2c7d2
2 changed files with 9 additions and 6 deletions
|
@ -66,14 +66,14 @@ static bool IsWithinTouchscreen(const Layout::FramebufferLayout& layout, u32 fra
|
||||||
framebuffer_x >= layout.screen.left && framebuffer_x < layout.screen.right);
|
framebuffer_x >= layout.screen.left && framebuffer_x < layout.screen.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<u32, u32> EmuWindow::ClipToTouchScreen(u32 new_x, u32 new_y) const {
|
std::pair<u32, u32> EmuWindow::ClipToTouchScreen(u32 new_x, u32 new_y) const {
|
||||||
new_x = std::max(new_x, framebuffer_layout.screen.left);
|
new_x = std::max(new_x, framebuffer_layout.screen.left);
|
||||||
new_x = std::min(new_x, framebuffer_layout.screen.right - 1);
|
new_x = std::min(new_x, framebuffer_layout.screen.right - 1);
|
||||||
|
|
||||||
new_y = std::max(new_y, framebuffer_layout.screen.top);
|
new_y = std::max(new_y, framebuffer_layout.screen.top);
|
||||||
new_y = std::min(new_y, framebuffer_layout.screen.bottom - 1);
|
new_y = std::min(new_y, framebuffer_layout.screen.bottom - 1);
|
||||||
|
|
||||||
return std::make_tuple(new_x, new_y);
|
return std::make_pair(new_x, new_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmuWindow::TouchPressed(u32 framebuffer_x, u32 framebuffer_y, size_t id) {
|
void EmuWindow::TouchPressed(u32 framebuffer_x, u32 framebuffer_y, size_t id) {
|
||||||
|
@ -107,11 +107,14 @@ void EmuWindow::TouchMoved(u32 framebuffer_x, u32 framebuffer_y, size_t id) {
|
||||||
if (id >= touch_state->status.size()) {
|
if (id >= touch_state->status.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!std::get<2>(touch_state->status[id]))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y))
|
if (!std::get<2>(touch_state->status[id])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsWithinTouchscreen(framebuffer_layout, framebuffer_x, framebuffer_y)) {
|
||||||
std::tie(framebuffer_x, framebuffer_y) = ClipToTouchScreen(framebuffer_x, framebuffer_y);
|
std::tie(framebuffer_x, framebuffer_y) = ClipToTouchScreen(framebuffer_x, framebuffer_y);
|
||||||
|
}
|
||||||
|
|
||||||
TouchPressed(framebuffer_x, framebuffer_y, id);
|
TouchPressed(framebuffer_x, framebuffer_y, id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,7 +228,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* Clip the provided coordinates to be inside the touchscreen area.
|
* Clip the provided coordinates to be inside the touchscreen area.
|
||||||
*/
|
*/
|
||||||
std::tuple<u32, u32> ClipToTouchScreen(u32 new_x, u32 new_y) const;
|
std::pair<u32, u32> ClipToTouchScreen(u32 new_x, u32 new_y) const;
|
||||||
|
|
||||||
Layout::FramebufferLayout framebuffer_layout; ///< Current framebuffer layout
|
Layout::FramebufferLayout framebuffer_layout; ///< Current framebuffer layout
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue