Advertisement
Guest User

libGDX changes from 1.7.0 - present (1.9.1)

a guest
Feb 13th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 35.13 KB | None | 0 0
  1. diff --git a/backends/gdx-backend-robovm/build-objectal.sh b/backends/gdx-backend-robovm/build-objectal.sh
  2. index d6fa45e..6e672d7 100755
  3. --- a/backends/gdx-backend-robovm/build-objectal.sh
  4. +++ b/backends/gdx-backend-robovm/build-objectal.sh
  5. @@ -1,17 +1,36 @@
  6.  #!/bin/bash
  7. -curl https://codeload.github.com/kstenerud/ObjectAL-for-iPhone/legacy.tar.gz/master -o objectal.tar.gz
  8. -tar xvfz objectal.tar.gz
  9. -cd kstenerud-ObjectAL-for-iPhone-a2252f3/ObjectAL
  10. -xcodebuild -arch armv7 -sdk iphoneos
  11. -cp build/Release-iphoneos/libObjectAl.a build/libObjectAl.a.armv7
  12. -xcodebuild -arch arm64 -sdk iphoneos
  13. -cp build/Release-iphoneos/libObjectAl.a build/libObjectAl.a.arm64
  14. -xcodebuild -arch i386 -sdk iphonesimulator
  15. -cp build/Release-iphonesimulator/libObjectAl.a build/libObjectAl.a.i386
  16. -xcodebuild -arch x86_64 -sdk iphonesimulator
  17. -cp build/Release-iphonesimulator/libObjectAl.a build/libObjectAl.a.x86_64
  18. -lipo build/libObjectAL.a.armv7 build/libObjectAL.a.arm64 build/libObjectAL.a.i386 build/libObjectAL.a.x86_64 -create -output build/libObjectAL.a
  19. -cp build/libObjectAL.a ../../../../gdx/libs/ios32/
  20. -cd ../..
  21. -rm objectal.tar.gz
  22. -rm -r kstenerud-ObjectAL-for-iPhone-a2252f3/
  23. +
  24. +BASE=$(cd $(dirname $0); pwd -P)
  25. +
  26. +BUILD_DIR=$BASE/target/objectal
  27. +rm -rf $BUILD_DIR
  28. +mkdir -p $BUILD_DIR
  29. +
  30. +curl https://codeload.github.com/libgdx/ObjectAL-for-iPhone/legacy.tar.gz/master -o $BUILD_DIR/objectal.tar.gz
  31. +
  32. +tar xvfz $BUILD_DIR/objectal.tar.gz -C $BUILD_DIR --strip-components 1
  33. +
  34. +XCODEPROJ=$BUILD_DIR/ObjectAL/ObjectAL.xcodeproj
  35. +
  36. +xcodebuild -project $XCODEPROJ -arch armv7  -sdk iphoneos         CONFIGURATION_BUILD_DIR=$BUILD_DIR/armv7  OTHER_CFLAGS="-fembed-bitcode -miphoneos-version-min=6.0"
  37. +xcodebuild -project $XCODEPROJ -arch arm64  -sdk iphoneos         CONFIGURATION_BUILD_DIR=$BUILD_DIR/arm64  OTHER_CFLAGS="-fembed-bitcode -miphoneos-version-min=6.0"
  38. +xcodebuild -project $XCODEPROJ -arch i386   -sdk iphonesimulator  CONFIGURATION_BUILD_DIR=$BUILD_DIR/i386   OTHER_CFLAGS="-miphoneos-version-min=6.0"
  39. +xcodebuild -project $XCODEPROJ -arch x86_64 -sdk iphonesimulator  CONFIGURATION_BUILD_DIR=$BUILD_DIR/x86_64 OTHER_CFLAGS="-miphoneos-version-min=6.0"
  40. +xcodebuild -project $XCODEPROJ -arch arm64  -sdk appletvos        CONFIGURATION_BUILD_DIR=$BUILD_DIR/tvos-arm64 OTHER_CFLAGS="-fembed-bitcode -mtvos-version-min=9.0"
  41. +xcodebuild -project $XCODEPROJ -arch x86_64 -sdk appletvsimulator CONFIGURATION_BUILD_DIR=$BUILD_DIR/tvos-x86_64 OTHER_CFLAGS="-mtvos-version-min=9.0"
  42. +
  43. +lipo $BUILD_DIR/armv7/libObjectAL.a \
  44. +     $BUILD_DIR/arm64/libObjectAL.a \
  45. +     $BUILD_DIR/i386/libObjectAL.a \
  46. +     $BUILD_DIR/x86_64/libObjectAL.a \
  47. +     -create \
  48. +     -output $BUILD_DIR/libObjectAL.a
  49. +
  50. +cp $BUILD_DIR/libObjectAL.a $BASE/../../gdx/libs/ios32/
  51. +
  52. +lipo $BUILD_DIR/tvos-arm64/libObjectAL.a \
  53. +     $BUILD_DIR/tvos-x86_64/libObjectAL.a \
  54. +     -create \
  55. +     -output $BUILD_DIR/libObjectAL.a.tvos
  56. +
  57. +cp $BUILD_DIR/libObjectAL.a.tvos $BASE/../../gdx/libs/ios32/
  58. diff --git a/backends/gdx-backend-robovm/pom.xml b/backends/gdx-backend-robovm/pom.xml
  59. index 3357905..8bc0d95 100644
  60. --- a/backends/gdx-backend-robovm/pom.xml
  61. +++ b/backends/gdx-backend-robovm/pom.xml
  62. @@ -4,7 +4,7 @@
  63.    <parent>
  64.      <groupId>com.badlogicgames.gdx</groupId>
  65.      <artifactId>gdx-parent</artifactId>
  66. -    <version>1.7.0</version>
  67. +    <version>1.9.3-SNAPSHOT</version>
  68.      <relativePath>../../pom.xml</relativePath>
  69.    </parent>
  70.  
  71. diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java
  72. index a61770c..4640691 100644
  73. --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java
  74. +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplication.java
  75. @@ -18,7 +18,7 @@ package com.badlogic.gdx.backends.iosrobovm;
  76.  
  77.  import java.io.File;
  78.  
  79. -import org.robovm.apple.coregraphics.CGSize;
  80. +import org.robovm.apple.coregraphics.CGRect;
  81.  import org.robovm.apple.foundation.Foundation;
  82.  import org.robovm.apple.foundation.NSMutableDictionary;
  83.  import org.robovm.apple.foundation.NSObject;
  84. @@ -102,6 +102,8 @@ public class IOSApplication implements Application {
  85.     /** The display scale factor (1.0f for normal; 2.0f to use retina coordinates/dimensions). */
  86.     float displayScaleFactor;
  87.  
  88. +   private CGRect lastScreenBounds = null;
  89. +
  90.     Array<Runnable> runnables = new Array<Runnable>();
  91.     Array<Runnable> executedRunnables = new Array<Runnable>();
  92.     Array<LifecycleListener> lifecycleListeners = new Array<LifecycleListener>();
  93. @@ -145,14 +147,11 @@ public class IOSApplication implements Application {
  94.             }
  95.         }
  96.  
  97. -       GL20 gl20 = new IOSGLES20();
  98. -
  99. -       Gdx.gl = gl20;
  100. -       Gdx.gl20 = gl20;
  101. -
  102.         // setup libgdx
  103.         this.input = new IOSInput(this);
  104. -       this.graphics = new IOSGraphics(getBounds(null), scale, this, config, input, gl20);
  105. +       this.graphics = new IOSGraphics(scale, this, config, input, config.useGL30);
  106. +       Gdx.gl = Gdx.gl20 = graphics.gl20;
  107. +       Gdx.gl30 = graphics.gl30;
  108.         this.files = new IOSFiles();
  109.         this.audio = new IOSAudio(config);
  110.         this.net = new IOSNet(this);
  111. @@ -190,57 +189,55 @@ public class IOSApplication implements Application {
  112.         return uiWindow;
  113.     }
  114.  
  115. -   /** Returns our real display dimension based on screen orientation.
  116. +   /** GL View spans whole screen, that is, even under the status bar. iOS can also rotate the screen, which is not handled
  117. +    * consistently over iOS versions. This method returns, in pixels, rectangle in which libGDX draws.
  118.      *
  119. -    * @param viewController The view controller.
  120. -    * @return Or real display dimension. */
  121. -   CGSize getBounds (UIViewController viewController) {
  122. -       // or screen size (always portrait)
  123. -       CGSize bounds = UIScreen.getMainScreen().getApplicationFrame().getSize();
  124. -
  125. -       // determine orientation and resulting width + height
  126. -       UIInterfaceOrientation orientation;
  127. -       if (viewController != null) {
  128. -           orientation = viewController.getInterfaceOrientation();
  129. -       } else if (config.orientationLandscape == config.orientationPortrait) {
  130. -           /*
  131. -            * if the app has orientation in any side then we can only check status bar orientation
  132. -            */
  133. -           orientation = uiApp.getStatusBarOrientation();
  134. -       } else if (config.orientationLandscape) {// is landscape true and portrait false
  135. -           orientation = UIInterfaceOrientation.LandscapeRight;
  136. -       } else {// is portrait true and landscape false
  137. -           orientation = UIInterfaceOrientation.Portrait;
  138. -       }
  139. -       int width;
  140. -       int height;
  141. -       switch (orientation) {
  142. +    * @return dimensions of space we draw to, adjusted for device orientation */
  143. +   protected CGRect getBounds () {
  144. +       final CGRect screenBounds = UIScreen.getMainScreen().getBounds();
  145. +       final CGRect statusBarFrame = uiApp.getStatusBarFrame();
  146. +       final UIInterfaceOrientation statusBarOrientation = uiApp.getStatusBarOrientation();
  147. +
  148. +       double statusBarHeight = Math.min(statusBarFrame.getWidth(), statusBarFrame.getHeight());
  149. +
  150. +       double screenWidth = screenBounds.getWidth();
  151. +       double screenHeight = screenBounds.getHeight();
  152. +
  153. +       // Make sure that the orientation is consistent with ratios. Should be, but may not be on older iOS versions
  154. +       switch (statusBarOrientation) {
  155.         case LandscapeLeft:
  156.         case LandscapeRight:
  157. -           height = (int)bounds.getWidth();
  158. -           width = (int)bounds.getHeight();
  159. -           if (width < height) {
  160. -               width = (int)bounds.getWidth();
  161. -               height = (int)bounds.getHeight();
  162. +           if (screenHeight > screenWidth) {
  163. +               debug("IOSApplication", "Switching reported width and height (w=" + screenWidth + " h=" + screenHeight + ")");
  164. +               double tmp = screenHeight;
  165. +               // noinspection SuspiciousNameCombination
  166. +               screenHeight = screenWidth;
  167. +               screenWidth = tmp;
  168.             }
  169. -           break;
  170. -       default:
  171. -           // assume portrait
  172. -           width = (int)bounds.getWidth();
  173. -           height = (int)bounds.getHeight();
  174.         }
  175.  
  176. -       Gdx.app.debug("IOSApplication", "Unscaled View: " + orientation.toString() + " " + width + "x" + height);
  177. -
  178.         // update width/height depending on display scaling selected
  179. -       width *= displayScaleFactor;
  180. -       height *= displayScaleFactor;
  181. +       screenWidth *= displayScaleFactor;
  182. +       screenHeight *= displayScaleFactor;
  183. +
  184. +       if (statusBarHeight != 0.0) {
  185. +           debug("IOSApplication", "Status bar is visible (height = " + statusBarHeight + ")");
  186. +           statusBarHeight *= displayScaleFactor;
  187. +           screenHeight -= statusBarHeight;
  188. +       } else {
  189. +           debug("IOSApplication", "Status bar is not visible");
  190. +       }
  191. +
  192. +       debug("IOSApplication", "Total computed bounds are w=" + screenWidth + " h=" + screenHeight);
  193.  
  194. -       // log screen dimensions
  195. -       Gdx.app.debug("IOSApplication", "View: " + orientation.toString() + " " + width + "x" + height);
  196. +       return lastScreenBounds = new CGRect(0.0, statusBarHeight, screenWidth, screenHeight);
  197. +   }
  198.  
  199. -       // return resulting view size (based on orientation)
  200. -       return new CGSize(width, height);
  201. +   protected CGRect getCachedBounds () {
  202. +       if (lastScreenBounds == null)
  203. +           return getBounds();
  204. +       else
  205. +           return lastScreenBounds;
  206.     }
  207.  
  208.     final void didBecomeActive (UIApplication uiApp) {
  209. diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplicationConfiguration.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplicationConfiguration.java
  210. index fb3a5f7..f813327 100644
  211. --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplicationConfiguration.java
  212. +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSApplicationConfiguration.java
  213. @@ -92,4 +92,9 @@ public class IOSApplicationConfiguration {
  214.    
  215.     /** whether or not the onScreenKeyboard should be closed on return key **/
  216.     public boolean keyboardCloseOnReturn = true;
  217. +
  218. +   /** Experimental, whether to enable OpenGL ES 3 if supported. If not supported it will fall-back to OpenGL ES 2.0.
  219. +    *  When GL ES 3 is enabled, {@link com.badlogic.gdx.Gdx#gl30} can be used to access it's functionality.
  220. +    * @deprecated this option is currently experimental and not yet fully supported, expect issues. */
  221. +   @Deprecated public boolean useGL30 = false;
  222.  }
  223. diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSDevice.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSDevice.java
  224. index f396183..470608d 100644
  225. --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSDevice.java
  226. +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSDevice.java
  227. @@ -17,12 +17,15 @@ public enum IOSDevice {
  228.     IPHONE_5S_CDMA_GSM("iPhone6,2", 326),
  229.     IPHONE_6_PLUS("iPhone7,1", 401),
  230.     IPHONE_6("iPhone7,2", 326),
  231. +   IPHONE_6S("iPhone8,1", 326),
  232. +   IPHONE_6S_PLUS("iPhone8,2", 401),
  233.    
  234.     IPOD_TOUCH_1G("iPod1,1", 163),
  235.     IPOD_TOUCH_2G("iPod2,1", 163),
  236.     IPOD_TOUCH_3G("iPod3,1", 163),
  237.     IPOD_TOUCH_4G("iPod4,1", 326),
  238.     IPOD_TOUCH_5G("iPod5,1", 326),
  239. +   IPOD_TOUCH_6G("iPod7,1", 326),
  240.    
  241.     IPAD("iPad1,1", 132),
  242.     IPAD_3G("iPad1,2", 132),
  243. @@ -47,8 +50,14 @@ public enum IOSDevice {
  244.     IPAD_MINI_RETINA_WIFI_CELLULAR_CN("iPad4,6", 326),
  245.     IPAD_MINI_3_WIFI("iPad4,7", 326),
  246.     IPAD_MINI_3_WIFI_CELLULAR("iPad4,8", 326),
  247. +   IPAD_MINI_3_WIFI_CELLULAR_CN("iPad4,9", 326),
  248. +   IPAD_MINI_4_WIFI("iPad5,1", 326),
  249. +   IPAD_MINI_4_WIFI_CELLULAR("iPad5,2", 326),
  250.     IPAD_MINI_AIR_2_WIFI("iPad5,3", 264),
  251.     IPAD_MINI_AIR_2_WIFI_CELLULAR("iPad5,4", 264),
  252. +   IPAD_PRO_WIFI("iPad6,7", 264),
  253. +   IPAD_PRO("iPad6,8", 264),
  254. +  
  255.     SIMULATOR_32("i386", 264),
  256.     SIMULATOR_64("x86_64", 264);
  257.    
  258. diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGLES30.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGLES30.java
  259. new file mode 100644
  260. index 0000000..f40762d
  261. --- /dev/null
  262. +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGLES30.java
  263. @@ -0,0 +1,201 @@
  264. +package com.badlogic.gdx.backends.iosrobovm;
  265. +
  266. +import com.badlogic.gdx.graphics.GL30;
  267. +
  268. +import java.nio.Buffer;
  269. +import java.nio.FloatBuffer;
  270. +import java.nio.IntBuffer;
  271. +import java.nio.LongBuffer;
  272. +
  273. +public class IOSGLES30 extends IOSGLES20 implements GL30 {
  274. +
  275. +    public IOSGLES30() {
  276. +        init();
  277. +    }
  278. +
  279. +    private static native void init( );
  280. +
  281. +    public native void glReadBuffer(int mode);
  282. +
  283. +    public native void glDrawRangeElements(int mode, int start, int end, int count, int type, Buffer indices);
  284. +
  285. +    public native void glDrawRangeElements(int mode, int start, int end, int count, int type, int offset);
  286. +
  287. +    public native void glTexImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int format, int type, Buffer pixels);
  288. +
  289. +    public native void glTexImage3D(int target, int level, int internalformat, int width, int height, int depth, int border, int format, int type, int offset);
  290. +
  291. +    public native void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, Buffer pixels);
  292. +
  293. +    public native void glTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int width, int height, int depth, int format, int type, int offset);
  294. +
  295. +    public native void glCopyTexSubImage3D(int target, int level, int xoffset, int yoffset, int zoffset, int x, int y, int width, int height);
  296. +
  297. +    public native void glGenQueries(int n, int[] ids, int offset);
  298. +
  299. +    public native void glGenQueries(int n, IntBuffer ids);
  300. +
  301. +    public native void glDeleteQueries(int n, int[] ids, int offset);
  302. +
  303. +    public native void glDeleteQueries(int n, IntBuffer ids);
  304. +
  305. +    public native boolean glIsQuery(int id);
  306. +
  307. +    public native void glBeginQuery(int target, int id);
  308. +
  309. +    public native void glEndQuery(int target);
  310. +
  311. +    public native void glGetQueryiv(int target, int pname, IntBuffer params);
  312. +
  313. +    public native void glGetQueryObjectuiv(int id, int pname, IntBuffer params);
  314. +
  315. +    public native boolean glUnmapBuffer(int target);
  316. +
  317. +    public native Buffer glGetBufferPointerv(int target, int pname);
  318. +
  319. +    public native void glDrawBuffers(int n, IntBuffer bufs);
  320. +
  321. +    public native void glUniformMatrix2x3fv(int location, int count, boolean transpose, FloatBuffer value);
  322. +
  323. +    public native void glUniformMatrix3x2fv(int location, int count, boolean transpose, FloatBuffer value);
  324. +
  325. +    public native void glUniformMatrix2x4fv(int location, int count, boolean transpose, FloatBuffer value);
  326. +
  327. +    public native void glUniformMatrix4x2fv(int location, int count, boolean transpose, FloatBuffer value);
  328. +
  329. +    public native void glUniformMatrix3x4fv(int location, int count, boolean transpose, FloatBuffer value);
  330. +
  331. +    public native void glUniformMatrix4x3fv(int location, int count, boolean transpose, FloatBuffer value);
  332. +
  333. +    public native void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1, int mask, int filter);
  334. +
  335. +    public native void glRenderbufferStorageMultisample(int target, int samples, int internalformat, int width, int height);
  336. +
  337. +    public native void glFramebufferTextureLayer(int target, int attachment, int texture, int level, int layer);
  338. +
  339. +    public native void glFlushMappedBufferRange(int target, int offset, int length);
  340. +
  341. +    public native void glBindVertexArray(int array);
  342. +
  343. +    public native void glDeleteVertexArrays(int n, int[] arrays, int offset);
  344. +
  345. +    public native void glDeleteVertexArrays(int n, IntBuffer arrays);
  346. +
  347. +    public native void glGenVertexArrays(int n, int[] arrays, int offset);
  348. +
  349. +    public native void glGenVertexArrays(int n, IntBuffer arrays);
  350. +
  351. +    public native boolean glIsVertexArray(int array);
  352. +
  353. +    public native void glBeginTransformFeedback(int primitiveMode);
  354. +
  355. +    public native void glEndTransformFeedback();
  356. +
  357. +    public native void glBindBufferRange(int target, int index, int buffer, int offset, int size);
  358. +
  359. +    public native void glBindBufferBase(int target, int index, int buffer);
  360. +
  361. +    public native void glTransformFeedbackVaryings(int program, String[] varyings, int bufferMode);
  362. +
  363. +    public native void glVertexAttribIPointer(int index, int size, int type, int stride, int offset);
  364. +
  365. +    public native void glGetVertexAttribIiv(int index, int pname, IntBuffer params);
  366. +
  367. +    public native void glGetVertexAttribIuiv(int index, int pname, IntBuffer params);
  368. +
  369. +    public native void glVertexAttribI4i(int index, int x, int y, int z, int w);
  370. +
  371. +    public native void glVertexAttribI4ui(int index, int x, int y, int z, int w);
  372. +
  373. +    public native void glGetUniformuiv(int program, int location, IntBuffer params);
  374. +
  375. +    public native int glGetFragDataLocation(int program, String name);
  376. +
  377. +    public native void glUniform1uiv(int location, int count, IntBuffer value);
  378. +
  379. +    public native void glUniform3uiv(int location, int count, IntBuffer value);
  380. +
  381. +    public native void glUniform4uiv(int location, int count, IntBuffer value);
  382. +
  383. +    public native void glClearBufferiv(int buffer, int drawbuffer, IntBuffer value);
  384. +
  385. +    public native void glClearBufferuiv(int buffer, int drawbuffer, IntBuffer value);
  386. +
  387. +    public native void glClearBufferfv(int buffer, int drawbuffer, FloatBuffer value);
  388. +
  389. +    public native void glClearBufferfi(int buffer, int drawbuffer, float depth, int stencil);
  390. +
  391. +    public native String glGetStringi(int name, int index);
  392. +
  393. +    public native void glCopyBufferSubData(int readTarget, int writeTarget, int readOffset, int writeOffset, int size);
  394. +
  395. +    public native void glGetUniformIndices(int program, String[] uniformNames, IntBuffer uniformIndices);
  396. +
  397. +    public native void glGetActiveUniformsiv(int program, int uniformCount, IntBuffer uniformIndices, int pname, IntBuffer params);
  398. +
  399. +    public native int glGetUniformBlockIndex(int program, String uniformBlockName);
  400. +
  401. +    public native void glGetActiveUniformBlockiv(int program, int uniformBlockIndex, int pname, IntBuffer params);
  402. +
  403. +    public native void glGetActiveUniformBlockName(int program, int uniformBlockIndex, Buffer length, Buffer uniformBlockName);
  404. +
  405. +    public native String glGetActiveUniformBlockName(int program, int uniformBlockIndex);
  406. +
  407. +    public native void glUniformBlockBinding(int program, int uniformBlockIndex, int uniformBlockBinding);
  408. +
  409. +    public native void glDrawArraysInstanced(int mode, int first, int count, int instanceCount);
  410. +
  411. +    public native void glDrawElementsInstanced(int mode, int count, int type, int indicesOffset, int instanceCount);
  412. +
  413. +    public native void glGetInteger64v(int pname, LongBuffer params);
  414. +
  415. +    public native void glGetBufferParameteri64v(int target, int pname, LongBuffer params);
  416. +
  417. +    public native void glGenSamplers(int count, int[] samplers, int offset);
  418. +
  419. +    public native void glGenSamplers(int count, IntBuffer samplers);
  420. +
  421. +    public native void glDeleteSamplers(int count, int[] samplers, int offset);
  422. +
  423. +    public native void glDeleteSamplers(int count, IntBuffer samplers);
  424. +
  425. +    public native boolean glIsSampler(int sampler);
  426. +
  427. +    public native void glBindSampler(int unit, int sampler);
  428. +
  429. +    public native void glSamplerParameteri(int sampler, int pname, int param);
  430. +
  431. +    public native void glSamplerParameteriv(int sampler, int pname, IntBuffer param);
  432. +
  433. +    public native void glSamplerParameterf(int sampler, int pname, float param);
  434. +
  435. +    public native void glSamplerParameterfv(int sampler, int pname, FloatBuffer param);
  436. +
  437. +    public native void glGetSamplerParameteriv(int sampler, int pname, IntBuffer params);
  438. +
  439. +    public native void glGetSamplerParameterfv(int sampler, int pname, FloatBuffer params);
  440. +
  441. +    public native void glVertexAttribDivisor(int index, int divisor);
  442. +
  443. +    public native void glBindTransformFeedback(int target, int id);
  444. +
  445. +    public native void glDeleteTransformFeedbacks(int n, int[] ids, int offset);
  446. +
  447. +    public native void glDeleteTransformFeedbacks(int n, IntBuffer ids);
  448. +
  449. +    public native void glGenTransformFeedbacks(int n, int[] ids, int offset);
  450. +
  451. +    public native void glGenTransformFeedbacks(int n, IntBuffer ids);
  452. +
  453. +    public native boolean glIsTransformFeedback(int id);
  454. +
  455. +    public native void glPauseTransformFeedback();
  456. +
  457. +    public native void glResumeTransformFeedback();
  458. +
  459. +    public native void glProgramParameteri(int program, int pname, int value);
  460. +
  461. +    public native void glInvalidateFramebuffer(int target, int numAttachments, IntBuffer attachments);
  462. +
  463. +    public native void glInvalidateSubFramebuffer(int target, int numAttachments, IntBuffer attachments, int x, int y, int width, int height);
  464. +}
  465. \ No newline at end of file
  466. 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
  467. index a26dae7..cc81fa1 100644
  468. --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGraphics.java
  469. +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSGraphics.java
  470. @@ -16,9 +16,7 @@
  471.  
  472.  
  473.  package com.badlogic.gdx.backends.iosrobovm;
  474.  
  475.  
  476.  
  477. -import org.robovm.apple.coregraphics.CGPoint;
  478.  
  479.  import org.robovm.apple.coregraphics.CGRect;
  480.  
  481. -import org.robovm.apple.coregraphics.CGSize;
  482.  
  483.  import org.robovm.apple.foundation.NSObject;
  484.  
  485.  import org.robovm.apple.glkit.GLKView;
  486.  
  487.  import org.robovm.apple.glkit.GLKViewController;
  488.  
  489. @@ -47,6 +45,7 @@ import com.badlogic.gdx.graphics.Cursor;
  490.  import com.badlogic.gdx.graphics.GL20;
  491.  
  492.  import com.badlogic.gdx.graphics.GL30;
  493.  
  494.  import com.badlogic.gdx.graphics.Pixmap;
  495.  
  496. +import com.badlogic.gdx.graphics.Cursor.SystemCursor;
  497.  
  498.  import com.badlogic.gdx.utils.Array;
  499.  
  500.  
  501.  
  502.  public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate, GLKViewControllerDelegate {
  503.  
  504. @@ -77,21 +76,6 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate,
  505.         }
  506.  
  507.  
  508.  
  509.         @Override
  510.  
  511. -       public void didRotate (UIInterfaceOrientation orientation) {
  512.  
  513. -           super.didRotate(orientation);
  514.  
  515. -           // get the view size and update graphics
  516.  
  517. -           // FIXME: supporting BOTH (landscape+portrait at same time) is
  518.  
  519. -           // currently not working correctly (needs fix)
  520.  
  521. -           // FIXME screen orientation needs to be stored for
  522.  
  523. -           // Input#getNativeOrientation
  524.  
  525. -           CGSize bounds = app.getBounds(this);
  526.  
  527. -           graphics.width = (int)bounds.getWidth();
  528.  
  529. -           graphics.height = (int)bounds.getHeight();
  530.  
  531. -           graphics.makeCurrent();
  532.  
  533. -           app.listener.resize(graphics.width, graphics.height);
  534.  
  535. -       }
  536.  
  537. -
  538.  
  539. -       @Override
  540.  
  541.         public UIInterfaceOrientationMask getSupportedInterfaceOrientations () {
  542.  
  543.             long mask = 0;
  544.  
  545.             if (app.config.orientationLandscape) {
  546.  
  547. @@ -120,6 +104,17 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate,
  548.             }
  549.  
  550.         }
  551.  
  552.  
  553.  
  554. +       @Override
  555.  
  556. +       public void viewDidLayoutSubviews () {
  557.  
  558. +           super.viewDidLayoutSubviews();
  559.  
  560. +           // get the view size and update graphics
  561.  
  562. +           CGRect bounds = app.getBounds();
  563.  
  564. +           graphics.width = (int)bounds.getWidth();
  565.  
  566. +           graphics.height = (int)bounds.getHeight();
  567.  
  568. +           graphics.makeCurrent();
  569.  
  570. +           app.listener.resize(graphics.width, graphics.height);
  571.  
  572. +       }
  573.  
  574. +      
  575.  
  576.         @Callback
  577.  
  578.         @BindSelector("shouldAutorotateToInterfaceOrientation:")
  579.  
  580.         private static boolean shouldAutorotateToInterfaceOrientation (IOSUIViewController self, Selector sel,
  581.  
  582. @@ -138,6 +133,7 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate,
  583.     IOSApplication app;
  584.  
  585.     IOSInput input;
  586.  
  587.     GL20 gl20;
  588.  
  589. +   GL30 gl30;
  590.  
  591.     int width;
  592.  
  593.     int height;
  594.  
  595.     long lastFrameTime;
  596.  
  597. @@ -164,36 +160,48 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate,
  598.     GLKView view;
  599.  
  600.     IOSUIViewController viewController;
  601.  
  602.  
  603.  
  604. -   public IOSGraphics (CGSize bounds, float scale, IOSApplication app, IOSApplicationConfiguration config, IOSInput input,
  605.  
  606. -       GL20 gl20) {
  607.  
  608. +   public IOSGraphics (float scale, IOSApplication app, IOSApplicationConfiguration config, IOSInput input, boolean useGLES30) {
  609.  
  610.         this.config = config;
  611.  
  612. +
  613.  
  614. +       final CGRect bounds = app.getBounds();
  615.  
  616.         // setup view and OpenGL
  617.  
  618.         width = (int)bounds.getWidth();
  619.  
  620.         height = (int)bounds.getHeight();
  621.  
  622. -       app.debug(tag, bounds.getWidth() + "x" + bounds.getHeight() + ", " + scale);
  623.  
  624. -       this.gl20 = gl20;
  625.  
  626.  
  627.  
  628. -       context = new EAGLContext(EAGLRenderingAPI.OpenGLES2);
  629.  
  630. +       if (useGLES30) {
  631.  
  632. +           context = new EAGLContext(EAGLRenderingAPI.OpenGLES3);
  633.  
  634. +           if (context != null)
  635.  
  636. +               gl20 = gl30 = new IOSGLES30();
  637.  
  638. +           else
  639.  
  640. +               Gdx.app.log("IOGraphics", "OpenGL ES 3.0 not supported, falling back on 2.0");
  641.  
  642. +       }
  643.  
  644. +       if (context == null) {
  645.  
  646. +           context = new EAGLContext(EAGLRenderingAPI.OpenGLES2);
  647.  
  648. +           gl20 = new IOSGLES20();
  649.  
  650. +           gl30 = null;
  651.  
  652. +       }
  653.  
  654. +
  655.  
  656.  
  657.  
  658. -       view = new GLKView(new CGRect(new CGPoint(0, 0), bounds), context) {
  659.  
  660. +
  661.  
  662. +       view = new GLKView(new CGRect(0, 0, bounds.getWidth(), bounds.getHeight()), context) {
  663.  
  664.             @Method(selector = "touchesBegan:withEvent:")
  665.  
  666.             public void touchesBegan (@Pointer long touches, UIEvent event) {
  667.  
  668. -               IOSGraphics.this.input.touchDown(touches, event);
  669.  
  670. +               IOSGraphics.this.input.onTouch(touches);
  671.  
  672.             }
  673.  
  674.  
  675.  
  676.             @Method(selector = "touchesCancelled:withEvent:")
  677.  
  678.             public void touchesCancelled (@Pointer long touches, UIEvent event) {
  679.  
  680. -               IOSGraphics.this.input.touchUp(touches, event);
  681.  
  682. +               IOSGraphics.this.input.onTouch(touches);
  683.  
  684.             }
  685.  
  686.  
  687.  
  688.             @Method(selector = "touchesEnded:withEvent:")
  689.  
  690.             public void touchesEnded (@Pointer long touches, UIEvent event) {
  691.  
  692. -               IOSGraphics.this.input.touchUp(touches, event);
  693.  
  694. +               IOSGraphics.this.input.onTouch(touches);
  695.  
  696.             }
  697.  
  698.  
  699.  
  700.             @Method(selector = "touchesMoved:withEvent:")
  701.  
  702.             public void touchesMoved (@Pointer long touches, UIEvent event) {
  703.  
  704. -               IOSGraphics.this.input.touchMoved(touches, event);
  705.  
  706. +               IOSGraphics.this.input.onTouch(touches);
  707.  
  708.             }
  709.  
  710.  
  711.  
  712.             @Override
  713.  
  714. @@ -240,7 +248,6 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate,
  715.             samples = 4;
  716.  
  717.         }
  718.  
  719.         bufferFormat = new BufferFormat(r, g, b, a, depth, stencil, samples, false);
  720.  
  721. -       this.gl20 = gl20;
  722.  
  723.  
  724.  
  725.         String machineString = HWMachine.getMachineString();
  726.  
  727.         IOSDevice device = IOSDevice.getDevice(machineString);
  728.  
  729. @@ -355,6 +362,16 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate,
  730.     public int getHeight () {
  731.  
  732.         return height;
  733.  
  734.     }
  735.  
  736. +  
  737.  
  738. +   @Override
  739.  
  740. +   public int getBackBufferWidth() {
  741.  
  742. +       return width;
  743.  
  744. +   }
  745.  
  746. +
  747.  
  748. +   @Override
  749.  
  750. +   public int getBackBufferHeight() {
  751.  
  752. +       return height;
  753.  
  754. +   }
  755.  
  756.  
  757.  
  758.     @Override
  759.  
  760.     public float getDeltaTime () {
  761.  
  762. @@ -408,28 +425,47 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate,
  763.  
  764.  
  765.     @Override
  766.  
  767.     public DisplayMode[] getDisplayModes () {
  768.  
  769. -       return new DisplayMode[] {getDesktopDisplayMode()};
  770.  
  771. +       return new DisplayMode[] {getDisplayMode()};
  772.  
  773.     }
  774.  
  775.  
  776.  
  777.     @Override
  778.  
  779. -   public DisplayMode getDesktopDisplayMode () {
  780.  
  781. +   public DisplayMode getDisplayMode () {
  782.  
  783.         return new IOSDisplayMode(getWidth(), getHeight(), config.preferredFramesPerSecond, bufferFormat.r + bufferFormat.g
  784.  
  785.             + bufferFormat.b + bufferFormat.a);
  786.  
  787.     }
  788.  
  789. +  
  790.  
  791. +   @Override
  792.  
  793. +   public Monitor getPrimaryMonitor() {
  794.  
  795. +       return new IOSMonitor(0, 0, "Primary Monitor");
  796.  
  797. +   }
  798.  
  799.  
  800.  
  801. -   private class IOSDisplayMode extends DisplayMode {
  802.  
  803. -       protected IOSDisplayMode (int width, int height, int refreshRate, int bitsPerPixel) {
  804.  
  805. -           super(width, height, refreshRate, bitsPerPixel);
  806.  
  807. -       }
  808.  
  809. +   @Override
  810.  
  811. +   public Monitor getMonitor() {
  812.  
  813. +       return getPrimaryMonitor();
  814.  
  815. +   }
  816.  
  817. +
  818.  
  819. +   @Override
  820.  
  821. +   public Monitor[] getMonitors() {
  822.  
  823. +       return new Monitor[] { getPrimaryMonitor() };
  824.  
  825. +   }
  826.  
  827. +
  828.  
  829. +   @Override
  830.  
  831. +   public DisplayMode[] getDisplayModes(Monitor monitor) {
  832.  
  833. +       return getDisplayModes();
  834.  
  835. +   }
  836.  
  837. +
  838.  
  839. +   @Override
  840.  
  841. +   public DisplayMode getDisplayMode(Monitor monitor) {
  842.  
  843. +       return getDisplayMode();
  844.  
  845.     }
  846.  
  847.  
  848.  
  849.     @Override
  850.  
  851. -   public boolean setDisplayMode (DisplayMode displayMode) {
  852.  
  853. +   public boolean setFullscreenMode (DisplayMode displayMode) {
  854.  
  855.         return false;
  856.  
  857.     }
  858.  
  859.  
  860.  
  861.     @Override
  862.  
  863. -   public boolean setDisplayMode (int width, int height, boolean fullscreen) {
  864.  
  865. +   public boolean setWindowedMode (int width, int height) {
  866.  
  867.         return false;
  868.  
  869.     }
  870.  
  871.  
  872.  
  873. @@ -502,4 +538,20 @@ public class IOSGraphics extends NSObject implements Graphics, GLKViewDelegate,
  874.     @Override
  875.  
  876.     public void setCursor (Cursor cursor) {
  877.  
  878.     }
  879.  
  880. +  
  881.  
  882. +   @Override
  883.  
  884. +   public void setSystemCursor (SystemCursor systemCursor) {
  885.  
  886. +   }
  887.  
  888. +  
  889.  
  890. +   private class IOSDisplayMode extends DisplayMode {
  891.  
  892. +       protected IOSDisplayMode (int width, int height, int refreshRate, int bitsPerPixel) {
  893.  
  894. +           super(width, height, refreshRate, bitsPerPixel);
  895.  
  896. +       }
  897.  
  898. +   }
  899.  
  900. +  
  901.  
  902. +   private class IOSMonitor extends Monitor {
  903.  
  904. +       protected IOSMonitor(int virtualX, int virtualY, String name) {
  905.  
  906. +           super(virtualX, virtualY, name);
  907.  
  908. +       }
  909.  
  910. +   }
  911.  
  912.  }
  913.  
  914. 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
  915. index 630bbb1..92add30 100644
  916. --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSInput.java
  917. +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSInput.java
  918. @@ -26,10 +26,7 @@ import org.robovm.apple.uikit.UIAlertView;
  919.  import org.robovm.apple.uikit.UIAlertViewDelegate;
  920.  import org.robovm.apple.uikit.UIAlertViewDelegateAdapter;
  921.  import org.robovm.apple.uikit.UIAlertViewStyle;
  922. -import org.robovm.apple.uikit.UIApplication;
  923.  import org.robovm.apple.uikit.UIDevice;
  924. -import org.robovm.apple.uikit.UIEvent;
  925. -import org.robovm.apple.uikit.UIInterfaceOrientation;
  926.  import org.robovm.apple.uikit.UIKeyboardType;
  927.  import org.robovm.apple.uikit.UIReturnKeyType;
  928.  import org.robovm.apple.uikit.UITextAutocapitalizationType;
  929. @@ -53,7 +50,6 @@ import com.badlogic.gdx.backends.iosrobovm.custom.UIAcceleration;
  930.  import com.badlogic.gdx.backends.iosrobovm.custom.UIAccelerometer;
  931.  import com.badlogic.gdx.backends.iosrobovm.custom.UIAccelerometerDelegate;
  932.  import com.badlogic.gdx.backends.iosrobovm.custom.UIAccelerometerDelegateAdapter;
  933. -import com.badlogic.gdx.math.MathUtils;
  934.  import com.badlogic.gdx.utils.Array;
  935.  import com.badlogic.gdx.utils.GdxRuntimeException;
  936.  import com.badlogic.gdx.utils.Pool;
  937. @@ -246,6 +242,7 @@ public class IOSInput implements Input {
  938.     public float getAccelerometerZ () {
  939.         return acceleration[2];
  940.     }
  941. +  
  942.  
  943.     @Override
  944.     public float getAzimuth () {
  945. @@ -534,6 +531,11 @@ public class IOSInput implements Input {
  946.     @Override
  947.     public void setCatchMenuKey (boolean catchMenu) {
  948.     }
  949. +  
  950. +   @Override
  951. +   public boolean isCatchMenuKey() {
  952. +       return false;
  953. +   }
  954.  
  955.     @Override
  956.     public void setInputProcessor (InputProcessor processor) {
  957. @@ -557,19 +559,29 @@ public class IOSInput implements Input {
  958.  
  959.     @Override
  960.     public int getRotation () {
  961. -       UIInterfaceOrientation orientation = app.graphics.viewController != null ? app.graphics.viewController
  962. -           .getInterfaceOrientation() : UIApplication.getSharedApplication().getStatusBarOrientation();
  963.         // we measure orientation counter clockwise, just like on Android
  964. -       if (orientation == UIInterfaceOrientation.Portrait) return 0;
  965. -       if (orientation == UIInterfaceOrientation.LandscapeLeft) return 270;
  966. -       if (orientation == UIInterfaceOrientation.PortraitUpsideDown) return 180;
  967. -       if (orientation == UIInterfaceOrientation.LandscapeRight) return 90;
  968. -       return 0;
  969. +       switch (app.uiApp.getStatusBarOrientation()) {
  970. +       case LandscapeLeft:
  971. +           return 270;
  972. +       case PortraitUpsideDown:
  973. +           return 180;
  974. +       case LandscapeRight:
  975. +           return 90;
  976. +       case Portrait:
  977. +       default:
  978. +           return 0;
  979. +       }
  980.     }
  981.  
  982.     @Override
  983.     public Orientation getNativeOrientation () {
  984. -       return Orientation.Portrait;
  985. +       switch (app.uiApp.getStatusBarOrientation()) {
  986. +       case LandscapeLeft:
  987. +       case LandscapeRight:
  988. +           return Orientation.Landscape;
  989. +       default:
  990. +           return Orientation.Portrait;
  991. +       }
  992.     }
  993.  
  994.     @Override
  995. @@ -585,18 +597,8 @@ public class IOSInput implements Input {
  996.     public void setCursorPosition (int x, int y) {
  997.     }
  998.  
  999. -   public void touchDown (long touches, UIEvent event) {
  1000. -       toTouchEvents(touches, event);
  1001. -       Gdx.graphics.requestRendering();
  1002. -   }
  1003. -
  1004. -   public void touchUp (long touches, UIEvent event) {
  1005. -       toTouchEvents(touches, event);
  1006. -       Gdx.graphics.requestRendering();
  1007. -   }
  1008. -
  1009. -   public void touchMoved (long touches, UIEvent event) {
  1010. -       toTouchEvents(touches, event);
  1011. +   protected void onTouch (long touches) {
  1012. +       toTouchEvents(touches);
  1013.         Gdx.graphics.requestRendering();
  1014.     }
  1015.  
  1016. @@ -653,18 +655,27 @@ public class IOSInput implements Input {
  1017.         public static native @MachineSizedUInt long count (@Pointer long thiz);
  1018.     }
  1019.  
  1020. -   private void toTouchEvents (long touches, UIEvent uiEvent) {
  1021. +   private void toTouchEvents (long touches) {
  1022.         long array = NSSetExtensions.allObjects(touches);
  1023.         int length = (int)NSArrayExtensions.count(array);
  1024.         for (int i = 0; i < length; i++) {
  1025.             long touchHandle = NSArrayExtensions.objectAtIndex$(array, i);
  1026.             UITouch touch = UI_TOUCH_WRAPPER.wrap(touchHandle);
  1027. -           CGPoint loc = touch.getLocationInView(touch.getView());
  1028. +           final int locX, locY;
  1029. +           // Get and map the location to our drawing space
  1030. +           {
  1031. +               CGPoint loc = touch.getLocationInView(touch.getWindow());
  1032. +               final CGRect bounds = app.getCachedBounds();
  1033. +               locX = (int)(loc.getX() * app.displayScaleFactor - bounds.getMinX());
  1034. +               locY = (int)(loc.getY() * app.displayScaleFactor - bounds.getMinY());
  1035. +               // app.debug("IOSInput","pos= "+loc+"  bounds= "+bounds+" x= "+locX+" locY= "+locY);
  1036. +           }
  1037. +
  1038.             synchronized (touchEvents) {
  1039.                 UITouchPhase phase = touch.getPhase();
  1040.                 TouchEvent event = touchEventPool.obtain();
  1041. -               event.x = (int)(loc.getX() * app.displayScaleFactor);
  1042. -               event.y = (int)(loc.getY() * app.displayScaleFactor);
  1043. +               event.x = locX;
  1044. +               event.y = locY;
  1045.                 event.phase = phase;
  1046.                 event.timestamp = (long)(touch.getTimestamp() * 1000000000);
  1047.                 touchEvents.add(event);
  1048. @@ -706,4 +717,24 @@ public class IOSInput implements Input {
  1049.         int x, y;
  1050.         int pointer;
  1051.     }
  1052. +
  1053. +   @Override
  1054. +   public float getGyroscopeX() {
  1055. +       // TODO Auto-generated method stub
  1056. +       return 0;
  1057. +   }
  1058. +
  1059. +   @Override
  1060. +   public float getGyroscopeY() {
  1061. +       // TODO Auto-generated method stub
  1062. +       return 0;
  1063. +   }
  1064. +
  1065. +   @Override
  1066. +   public float getGyroscopeZ() {
  1067. +       // TODO Auto-generated method stub
  1068. +       return 0;
  1069. +   }
  1070. +
  1071. +
  1072.  }
  1073. diff --git a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSSound.java b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSSound.java
  1074. index a0440ce..a25b276 100644
  1075. --- a/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSSound.java
  1076. +++ b/backends/gdx-backend-robovm/src/com/badlogic/gdx/backends/iosrobovm/IOSSound.java
  1077. @@ -134,11 +134,6 @@ public class IOSSound implements Sound {
  1078.     }
  1079.  
  1080.     @Override
  1081. -   public void setPriority (long soundId, int priority) {
  1082. -       // TODO Auto-generated method stub
  1083. -   }
  1084. -
  1085. -   @Override
  1086.     public void pause () {
  1087.         ALSource source;
  1088.         for (int i = 0; i < streamIds.size; i++) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement