mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 04:29:13 +12:00
Merge branch 'master' into shader-decomp
This commit is contained in:
commit
fd90cf7d9f
3 changed files with 20 additions and 8 deletions
|
@ -162,8 +162,13 @@ void FrontendSDL::run() {
|
|||
if (emu.romType == ROMType::None) break;
|
||||
|
||||
if (event.button.button == SDL_BUTTON_LEFT) {
|
||||
const s32 x = event.button.x;
|
||||
const s32 y = event.button.y;
|
||||
if (windowWidth == 0 || windowHeight == 0) [[unlikely]] {
|
||||
break;
|
||||
}
|
||||
|
||||
// Go from window positions to [0, 400) for x and [0, 480) for y
|
||||
const s32 x = (s32)std::round(event.button.x * 400.f / windowWidth);
|
||||
const s32 y = (s32)std::round(event.button.y * 480.f / windowHeight);
|
||||
|
||||
// Check if touch falls in the touch screen area
|
||||
if (y >= 240 && y <= 480 && x >= 40 && x < 40 + 320) {
|
||||
|
@ -242,8 +247,13 @@ void FrontendSDL::run() {
|
|||
|
||||
// Handle "dragging" across the touchscreen
|
||||
if (hid.isTouchScreenPressed()) {
|
||||
const s32 x = event.motion.x;
|
||||
const s32 y = event.motion.y;
|
||||
if (windowWidth == 0 || windowHeight == 0) [[unlikely]] {
|
||||
break;
|
||||
}
|
||||
|
||||
// Go from window positions to [0, 400) for x and [0, 480) for y
|
||||
const s32 x = (s32)std::round(event.motion.x * 400.f / windowWidth);
|
||||
const s32 y = (s32)std::round(event.motion.y * 480.f / windowHeight);
|
||||
|
||||
// Check if touch falls in the touch screen area and register the new touch screen position
|
||||
if (y >= 240 && y <= 480 && x >= 40 && x < 40 + 320) {
|
||||
|
@ -293,9 +303,9 @@ void FrontendSDL::run() {
|
|||
case SDL_WINDOWEVENT: {
|
||||
auto type = event.window.event;
|
||||
if (type == SDL_WINDOWEVENT_RESIZED) {
|
||||
const u32 width = event.window.data1;
|
||||
const u32 height = event.window.data2;
|
||||
emu.setOutputSize(width, height);
|
||||
windowWidth = event.window.data1;
|
||||
windowHeight = event.window.data2;
|
||||
emu.setOutputSize(windowWidth, windowHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue