OSDN Git Service

Stub out Thread and Texture a bit more for GWT backend
authorbitiotic <github@bitiotic.com>
Tue, 12 Feb 2013 18:48:39 +0000 (10:48 -0800)
committerbitiotic <github@bitiotic.com>
Wed, 13 Feb 2013 07:45:13 +0000 (23:45 -0800)
Add a (working?) Thread.setUncaughtExceptionHandler.

Add a no-op setEnforcePotImages() on Texture.

backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/graphics/Texture.java
backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/java/lang/Thread.java

index 425766b..fbae817 100644 (file)
@@ -170,6 +170,10 @@ public class Texture implements Disposable {
                        pixmap.getGLType(), pixmap.getPixels());\r
        }\r
 \r
+       static public void setEnforcePotImages (boolean enforcePotImages) {\r
+               /* doesn't matter on GWT ... hopefully? */\r
+       }\r
+       \r
        /** @return the width of the texture in pixels */\r
        public int getWidth () {\r
                return data.getWidth();\r
index e81c218..43d3f47 100644 (file)
 \r
 package java.lang;\r
 \r
+import com.google.gwt.core.client.GWT;\r
+\r
 public class Thread {\r
        public static void sleep (long millis) throws InterruptedException {\r
                // noop emu\r
        }\r
+       \r
+       public static void setDefaultUncaughtExceptionHandler(final Thread.UncaughtExceptionHandler javaHandler) {\r
+               GWT.setUncaughtExceptionHandler(new GWT.UncaughtExceptionHandler() {\r
+                       @Override\r
+                       public void onUncaughtException (Throwable e) {\r
+                               final Thread th = new Thread() {\r
+                                       @Override\r
+                                       public String toString() {\r
+                                               return "The only thread";\r
+                                       }\r
+                               };\r
+                               javaHandler.uncaughtException(th, e);\r
+                       }\r
+               });\r
+       }\r
+       \r
+       public static interface UncaughtExceptionHandler {\r
+               void uncaughtException(Thread t, Throwable e);\r
+       }\r
 }\r