v0.9.3: added casts to buffer methods to prevent JDK 9+ issues

This commit is contained in:
Evan Debenham
2021-05-09 17:19:15 -04:00
parent 9412eb81f4
commit ef8750b326
15 changed files with 51 additions and 34 deletions
@@ -28,6 +28,7 @@ import com.watabou.glwrap.Quad;
import com.watabou.glwrap.Vertexbuffer;
import com.watabou.utils.RectF;
import java.nio.Buffer;
import java.nio.FloatBuffer;
public class BitmapText extends Visual {
@@ -74,7 +75,7 @@ public class BitmapText extends Visual {
if (dirty) {
updateVertices();
quads.limit(quads.position());
((Buffer)quads).limit(quads.position());
if (buffer == null)
buffer = new Vertexbuffer(quads);
else
@@ -27,6 +27,7 @@ import com.watabou.glwrap.Quad;
import com.watabou.glwrap.Vertexbuffer;
import com.watabou.utils.RectF;
import java.nio.Buffer;
import java.nio.FloatBuffer;
public class Image extends Visual {
@@ -156,7 +157,7 @@ public class Image extends Visual {
super.draw();
if (dirty) {
verticesBuffer.position( 0 );
((Buffer)verticesBuffer).position( 0 );
verticesBuffer.put( vertices );
if (buffer == null)
buffer = new Vertexbuffer( verticesBuffer );
@@ -27,6 +27,7 @@ import com.watabou.glwrap.Quad;
import com.watabou.glwrap.Vertexbuffer;
import com.watabou.utils.RectF;
import java.nio.Buffer;
import java.nio.FloatBuffer;
public class NinePatch extends Visual {
@@ -91,7 +92,7 @@ public class NinePatch extends Visual {
protected void updateVertices() {
quads.position( 0 );
((Buffer)quads).position( 0 );
float right = width - marginRight;
float bottom = height - marginBottom;
@@ -28,6 +28,7 @@ import com.watabou.glwrap.Quad;
import com.watabou.glwrap.Uniform;
import com.watabou.glwrap.Vertexbuffer;
import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;
@@ -72,11 +73,11 @@ public class NoosaScript extends Script {
}
public void drawElements( FloatBuffer vertices, ShortBuffer indices, int size ) {
vertices.position( 0 );
((Buffer)vertices).position( 0 );
aXY.vertexPointer( 2, 4, vertices );
vertices.position( 2 );
((Buffer)vertices).position( 2 );
aUV.vertexPointer( 2, 4, vertices );
Quad.releaseIndices();
@@ -85,11 +86,11 @@ public class NoosaScript extends Script {
}
public void drawQuad( FloatBuffer vertices ) {
vertices.position( 0 );
((Buffer)vertices).position( 0 );
aXY.vertexPointer( 2, 4, vertices );
vertices.position( 2 );
((Buffer)vertices).position( 2 );
aUV.vertexPointer( 2, 4, vertices );
Gdx.gl20.glDrawElements( Gdx.gl20.GL_TRIANGLES, Quad.SIZE, Gdx.gl20.GL_UNSIGNED_SHORT, 0 );
@@ -114,11 +115,11 @@ public class NoosaScript extends Script {
if (size == 0) {
return;
}
vertices.position( 0 );
((Buffer)vertices).position( 0 );
aXY.vertexPointer( 2, 4, vertices );
vertices.position( 2 );
((Buffer)vertices).position( 2 );
aUV.vertexPointer( 2, 4, vertices );
Gdx.gl20.glDrawElements( Gdx.gl20.GL_TRIANGLES, Quad.SIZE * size, Gdx.gl20.GL_UNSIGNED_SHORT, 0 );
@@ -33,6 +33,7 @@ import com.badlogic.gdx.math.Matrix4;
import com.watabou.glwrap.Matrix;
import com.watabou.glwrap.Quad;
import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.util.HashMap;
@@ -155,7 +156,7 @@ public class RenderedText extends Image {
FloatBuffer toOpenGL;
if (buffers.containsKey(count/20)){
toOpenGL = buffers.get(count/20);
toOpenGL.position(0);
((Buffer)toOpenGL).position(0);
} else {
toOpenGL = Quad.createSet(count / 20);
buffers.put(count/20, toOpenGL);
@@ -190,8 +191,8 @@ public class RenderedText extends Image {
toOpenGL.put(vertices);
}
toOpenGL.position(0);
((Buffer)toOpenGL).position(0);
NoosaScript script = NoosaScript.get();
@@ -28,6 +28,7 @@ import com.watabou.glwrap.Vertexbuffer;
import com.watabou.utils.Rect;
import com.watabou.utils.RectF;
import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.util.Arrays;
@@ -136,7 +137,7 @@ public class Tilemap extends Visual {
bottomRightUpdating = pos + 1;
quads.position(pos*16);
((Buffer)quads).position(pos*16);
uv = tileset.get(data[pos]);