From 528849d460e279ad16b2fc21227b1cbd3a829bd1 Mon Sep 17 00:00:00 2001 From: badlogic Date: Wed, 18 Sep 2013 20:56:54 +0200 Subject: [PATCH] fixed multitouch and IOSInput#touchDown to be long --- .../src/com/badlogic/gdx/backends/iosrobovm/IOSGraphics.java | 1 + .../src/com/badlogic/gdx/backends/iosrobovm/IOSInput.java | 8 ++++---- .../com/badlogic/gdx/backends/iosrobovm/IOSPreferences.java | 1 + backends/gdx-backend-robovm/todos.txt | 12 +++++------- .../src/com/badlogic/gdx/tests/IOSRobovmTests.java | 3 +-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGraphics.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGraphics.java index 339a36876..5dfdd39c5 100644 --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGraphics.java +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGraphics.java @@ -166,6 +166,7 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate, view.setDrawableDepthFormat(config.depthFormat); view.setDrawableStencilFormat(config.stencilFormat); view.setDrawableMultisample(config.multisample); + view.setMultipleTouchEnabled(true); viewController = new IOSUIViewController(app, this); viewController.setView(view); diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSInput.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSInput.java index 28cdfd7bb..1c0225114 100644 --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSInput.java +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSInput.java @@ -39,7 +39,7 @@ public class IOSInput implements Input { int[] touchX = new int[MAX_TOUCHES]; int[] touchY = new int[MAX_TOUCHES]; // we store the pointer to the UITouch struct here, or 0 - int[] touchDown = new int[MAX_TOUCHES]; + long[] touchDown = new long[MAX_TOUCHES]; int numTouched = 0; boolean justTouched = false; Pool touchEventPool = new Pool() { @@ -388,7 +388,7 @@ public class IOSInput implements Input { } private int findPointer(UITouch touch) { - int ptr = (int) touch.getHandle(); + long ptr = touch.getHandle(); for(int i = 0; i < touchDown.length; i++) { if(touchDown[i] == ptr) return i; } @@ -406,7 +406,7 @@ public class IOSInput implements Input { event.timestamp = (long)(touch.getTimestamp() * 1000000000); touchEvents.add(event); - if(touch.getPhase() == UITouchPhase.Began) { + if(touch.getPhase() == UITouchPhase.Began) { event.pointer = getFreePointer(); touchDown[event.pointer] = (int) touch.getHandle(); touchX[event.pointer] = event.x; @@ -426,7 +426,7 @@ public class IOSInput implements Input { } if(touch.getPhase() == UITouchPhase.Cancelled || - touch.getPhase() == UITouchPhase.Ended) { + touch.getPhase() == UITouchPhase.Ended) { event.pointer = findPointer(touch); touchDown[event.pointer] = 0; touchX[event.pointer] = event.x; diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSPreferences.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSPreferences.java index c392565a5..695bf4b58 100644 --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSPreferences.java +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSPreferences.java @@ -4,6 +4,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Set; +import org.robovm.cocoatouch.foundation.NSBundle; import org.robovm.cocoatouch.foundation.NSMutableDictionary; import org.robovm.cocoatouch.foundation.NSNumber; import org.robovm.cocoatouch.foundation.NSObject; diff --git a/backends/gdx-backend-robovm/todos.txt b/backends/gdx-backend-robovm/todos.txt index 093f36852..316df2e2e 100644 --- a/backends/gdx-backend-robovm/todos.txt +++ b/backends/gdx-backend-robovm/todos.txt @@ -21,16 +21,14 @@ General - check if apps supporting both portrait and landscape work (resize, etc.) - implement non-continuous rendering - IOSInput - - Multitouch is broken - - IOSInput#touchDown is a bit bonkers, with 64-bit iOS that might become an issue (it's an int, not a long) + - getRotation() needs to be implemented + - getNativeOrientation() needs to be implemented, see IOSInput - getAzimuth(), getPitch(), getRoll(), getRotationMatrix() need to be implemented and output the same as android - - see if we can programmatically show the keyboard and receive key events, if so map to gdx keycodes - - getPlaceholderTextInput() needs to be implemented - vibrate(), cancelVibrate() needs to be implemented - - we should totally refactor setCatchBackKey and consorts eventually... + - see if we can programmatically show the keyboard and receive key events, if so map to gdx keycodes + - getPlaceholderTextInput() needs to be implemented - add compass support, fix up isPeripheralAvailable(), including onscreen keyboard stuff - - getRotation() needs to be implemented - - getNativeOrientation() needs to be implemented, see IOSInput + - IOSMusic - OGG support - IOSNet diff --git a/tests/gdx-tests-iosrobovm/src/com/badlogic/gdx/tests/IOSRobovmTests.java b/tests/gdx-tests-iosrobovm/src/com/badlogic/gdx/tests/IOSRobovmTests.java index 34acc6f56..c1846fcdd 100644 --- a/tests/gdx-tests-iosrobovm/src/com/badlogic/gdx/tests/IOSRobovmTests.java +++ b/tests/gdx-tests-iosrobovm/src/com/badlogic/gdx/tests/IOSRobovmTests.java @@ -5,7 +5,6 @@ import org.robovm.cocoatouch.uikit.UIApplication; import com.badlogic.gdx.backends.iosrobovm.IOSApplication; import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; -import com.badlogic.gdx.tests.gwt.GwtTestWrapper; public class IOSRobovmTests extends IOSApplication.Delegate { class InnerClass { @@ -14,7 +13,7 @@ public class IOSRobovmTests extends IOSApplication.Delegate { @Override protected IOSApplication createApplication() { IOSApplicationConfiguration config = new IOSApplicationConfiguration(); - return new IOSApplication(new GwtTestWrapper(), config); + return new IOSApplication(new MultitouchTest(), config); } public static void main(String[] argv) { -- 2.11.0