Skip to content

Commit

Permalink
Updated dependencies and added buffer casts
Browse files Browse the repository at this point in the history
  • Loading branch information
00-Evan committed Jul 12, 2021
1 parent 576b36c commit 6fffc07
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 23 deletions.
3 changes: 2 additions & 1 deletion PD-classes/src/main/java/com/watabou/glwrap/Quad.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package com.watabou.glwrap;

import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
Expand Down Expand Up @@ -77,7 +78,7 @@ public static ShortBuffer getIndices( int size ) {
}

indices.put( values );
indices.position( 0 );
((Buffer)indices).position( 0 );
}

return indices;
Expand Down
5 changes: 3 additions & 2 deletions PD-classes/src/main/java/com/watabou/glwrap/Texture.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package com.watabou.glwrap;

import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.IntBuffer;
Expand Down Expand Up @@ -96,7 +97,7 @@ public void pixels( int w, int h, int[] pixels ) {
order( ByteOrder.nativeOrder() ).
asIntBuffer();
imageBuffer.put( pixels );
imageBuffer.position( 0 );
((Buffer)imageBuffer).position( 0 );

GLES20.glTexImage2D(
GLES20.GL_TEXTURE_2D,
Expand All @@ -118,7 +119,7 @@ public void pixels( int w, int h, byte[] pixels ) {
allocateDirect( w * h ).
order( ByteOrder.nativeOrder() );
imageBuffer.put( pixels );
imageBuffer.position( 0 );
((Buffer)imageBuffer).position( 0 );

GLES20.glPixelStorei( GLES20.GL_UNPACK_ALIGNMENT, 1 );

Expand Down
3 changes: 2 additions & 1 deletion PD-classes/src/main/java/com/watabou/noosa/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package com.watabou.noosa;

import java.nio.Buffer;
import java.nio.FloatBuffer;

import android.graphics.RectF;
Expand Down Expand Up @@ -161,7 +162,7 @@ public void draw() {
ra, ga, ba, aa );

if (dirty) {
verticesBuffer.position( 0 );
((Buffer)verticesBuffer).position( 0 );
verticesBuffer.put( vertices );
dirty = false;
}
Expand Down
3 changes: 2 additions & 1 deletion PD-classes/src/main/java/com/watabou/noosa/NinePatch.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package com.watabou.noosa;

import java.nio.Buffer;
import java.nio.FloatBuffer;

import com.watabou.gltextures.SmartTexture;
Expand Down Expand Up @@ -88,7 +89,7 @@ public NinePatch( Object tx, int x, int y, int w, int h, int left, int top, int

protected void updateVertices() {

verticesBuffer.position( 0 );
((Buffer)verticesBuffer).position( 0 );

float right = width - marginRight;
float bottom = height - marginBottom;
Expand Down
25 changes: 13 additions & 12 deletions PD-classes/src/main/java/com/watabou/noosa/NoosaScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package com.watabou.noosa;

import java.nio.Buffer;
import java.nio.FloatBuffer;
import java.nio.ShortBuffer;

Expand Down Expand Up @@ -69,23 +70,23 @@ public void use() {
}

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 );

GLES20.glDrawElements( GLES20.GL_TRIANGLES, size, GLES20.GL_UNSIGNED_SHORT, indices );

}

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 );

GLES20.glDrawElements( GLES20.GL_TRIANGLES, Quad.SIZE, GLES20.GL_UNSIGNED_SHORT, Quad.getIndices( 1 ) );
Expand All @@ -97,11 +98,11 @@ public void drawQuadSet( FloatBuffer vertices, int size ) {
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 );

GLES20.glDrawElements(
Expand Down
3 changes: 2 additions & 1 deletion PD-classes/src/main/java/com/watabou/noosa/Tilemap.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

package com.watabou.noosa;

import java.nio.Buffer;
import java.nio.FloatBuffer;

import com.watabou.gltextures.SmartTexture;
Expand Down Expand Up @@ -91,7 +92,7 @@ protected void updateVertices() {
float x2 = x1 + cellW;

int pos = i * mapWidth + updated.left;
quads.position( 16 * pos );
((Buffer)quads).position( 16 * pos );

for (int j=updated.left; j < updated.right; j++) {

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.android.tools.build:gradle:4.2.2'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package com.watabou.pixeldungeon.effects;

import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
Expand Down Expand Up @@ -101,7 +102,7 @@ public Flare( int nRays, float radius ) {
indices.put( (short)(2 + i * 2) );
}

indices.position( 0 );
((Buffer)indices).position( 0 );
}

public Flare color( int color, boolean lightMode ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package com.watabou.pixeldungeon.scenes;

import java.nio.Buffer;
import java.nio.FloatBuffer;

import com.watabou.gltextures.Gradient;
Expand Down Expand Up @@ -221,8 +222,8 @@ public Sky( boolean dayTime ) {

vertices[12] = 0;
vertices[13] = 1;
verticesBuffer.position( 0 );

((Buffer)verticesBuffer).position( 0 );
verticesBuffer.put( vertices );
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 6fffc07

Please sign in to comment.