1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 01:20:37 +00:00

more Android fixes

This commit is contained in:
Zeno Rogue 2018-06-07 19:53:02 +02:00
parent 3726a896e2
commit 4de2f8311e

View File

@ -27,7 +27,7 @@ public class HyperRenderer implements GLSurfaceView.Renderer {
int [] graphdata; int [] graphdata;
int gdpos; int gdpos;
int gdpop() { return graphdata[gdpos++]; } int gdpop() { return graphdata[gdpos++]; }
boolean initialized; boolean initialized;
public void onDrawFrame(GL10 unused) { public void onDrawFrame(GL10 unused) {
if(game.forceCanvas) return; if(game.forceCanvas) return;
@ -39,10 +39,10 @@ public class HyperRenderer implements GLSurfaceView.Renderer {
GLES20.glClear(GL10.GL_COLOR_BUFFER_BIT); GLES20.glClear(GL10.GL_COLOR_BUFFER_BIT);
synchronized(game) { synchronized(game) {
if(!initialized) { game.glhrinit(); initialized = true; } if(!initialized) { game.glhrinit(); initialized = true; }
game.hv.updateGame(); game.hv.updateGame();
game.draw(); game.draw();
graphdata = game.loadMap(); graphdata = game.loadMap();
glText.shader.aPosition = game.getaPosition(); glText.shader.aPosition = game.getaPosition();
glText.shader.aTexture = game.getaTexture(); glText.shader.aTexture = game.getaTexture();
glText.shader.uColor = game.getuColor(); glText.shader.uColor = game.getuColor();
@ -51,7 +51,8 @@ public class HyperRenderer implements GLSurfaceView.Renderer {
if(graphdata == null) return; if(graphdata == null) return;
gdpos = 0; gdpos = 0;
while(gdpos < graphdata.length) {
while(gdpos < graphdata.length) {
switch(gdpop()) { switch(gdpop()) {
case 2: { case 2: {
int x = gdpop(); int x = gdpop();
@ -98,8 +99,8 @@ public class HyperRenderer implements GLSurfaceView.Renderer {
GLES20.glViewport(0, 0, width, height); GLES20.glViewport(0, 0, width, height);
// Save width and height // Save width and height
this.width = width; // Save Current Width this.width = width; // Save Current Width
this.height = height; // Save Current Height this.height = height; // Save Current Height
initialized = false; initialized = false;
} }
@ -108,7 +109,7 @@ public class HyperRenderer implements GLSurfaceView.Renderer {
glText = new GLText( new Shader() ); glText = new GLText( new Shader() );
glText.load(Typeface.DEFAULT_BOLD, 48, 2, 2 ); // Create Font (Height: 48 Pixels / X+Y Padding 2 Pixels) glText.load(Typeface.DEFAULT_BOLD, 48, 2, 2 ); // Create Font (Height: 48 Pixels / X+Y Padding 2 Pixels)
initialized = false; initialized = false;
} }