From 88d43a842036805d88483c46c5ada5c6aff8cf1f Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Mon, 5 Feb 2024 21:45:10 +1100 Subject: [PATCH] DS: Fix can't move camera --- src/Window_NDS.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/Window_NDS.c b/src/Window_NDS.c index 21e47601a..64650dd31 100644 --- a/src/Window_NDS.c +++ b/src/Window_NDS.c @@ -90,23 +90,23 @@ static void HandleButtons(int mods) { static void ProcessTouchInput(int mods) { touchPosition pos; touchRead(&pos); - touchActive = mods & KEY_TOUCH; - if (touchActive) { - Pointer_SetPosition(0, pos.px, pos.py); - } // Set starting position for camera movement - if (mods & KEY_TOUCH) { + if (!touchActive && (mods & KEY_TOUCH)) { touchBegX = pos.px; touchBegY = pos.py; } + + touchActive = mods & KEY_TOUCH; + if (touchActive) { + Pointer_SetPosition(0, pos.px, pos.py); + } } void Window_ProcessEvents(double delta) { scanKeys(); int keys = keysDown() | keysHeld(); - Platform_Log1("KEYS: %h", &keys); HandleButtons(keys); Input_SetNonRepeatable(CCMOUSE_L, keys & KEY_TOUCH); @@ -123,9 +123,6 @@ void Window_UpdateRawMouse(void) { touchPosition touch; touchRead(&touch); - int DX = touch.px - touchBegX; - int DY = touch.py - touchBegY; - Platform_Log2("DELTA: %i, %i", &DX, &DY); Event_RaiseRawMove(&PointerEvents.RawMoved, touch.px - touchBegX, touch.py - touchBegY); touchBegX = touch.px;