Fixed bug with android 8.0 and opengl
This commit is contained in:
@ -103,6 +103,14 @@ public class Entity extends Quad {
|
||||
return maxTexSize;
|
||||
}
|
||||
|
||||
public float calcTexScaleX() {
|
||||
return getMaxTexSize().x == 0 ? 1 : getWidth() / getMaxTexSize().x;
|
||||
}
|
||||
|
||||
public float calcTexScaleY() {
|
||||
return getMaxTexSize().y == 0 ? 1 : getHeight() / getMaxTexSize().y;
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public enum ToolType {
|
||||
new ToolUpgrade(ToolUpgradeType.COOLDOWN, 5000, 3000),
|
||||
new ToolUpgrade(ToolUpgradeType.FORCE, 100, 500)),
|
||||
POWER_MUSHROOM(R.string.tool_name_power_mushroom, R.string.tool_description_power_mushroom,
|
||||
R.drawable.tools_power_mushroom, R.drawable.tools_power_mushroom_button, 5,
|
||||
R.drawable.tools_power_mushroom, R.drawable.tools_power_mushroom_button, 50,
|
||||
5, 7, new ToolUpgrade(ToolUpgradeType.COOLDOWN, 15000, 11000),
|
||||
new ToolUpgrade(ToolUpgradeType.DURATION, 5000, 10000)),
|
||||
STASIS(R.string.tool_name_stasis, R.string.tool_description_stasis, R.drawable.tools_stasis,
|
||||
|
@ -168,7 +168,7 @@ public class Game extends Rendering<GameScene> {
|
||||
if (gameState == GameState.RUNNING) {
|
||||
ToolButtonBar bar = viewManager.toolButtonBar;
|
||||
ToolButton button = bar.getByToolType(currentTool);
|
||||
if (button != null && button.finishedLoading()) {
|
||||
if (button != null && button.finishedLoading() && button.getToolType() != null) {
|
||||
if (event.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
if (currentTool == ToolType.BOMB) {
|
||||
try {
|
||||
|
@ -1,5 +1,7 @@
|
||||
package de.frajul.endlessroll.main.game;
|
||||
|
||||
import de.frajul.endlessroll.data.Vector;
|
||||
import de.frajul.endlessroll.entities.Entity;
|
||||
import de.frajul.endlessroll.entities.particles.ParticleSystem;
|
||||
import de.frajul.endlessroll.entities.shapes.PlayerShape;
|
||||
import de.frajul.endlessroll.entities.textures.TexturePack;
|
||||
@ -10,10 +12,11 @@ public class TestScreenScene extends Scene {
|
||||
|
||||
public TestScreenScene(GameActivity gameActivity, TexturePack texturePack, ParticleSystem particleSystem) {
|
||||
super(gameActivity, texturePack, particleSystem);
|
||||
terrain.createEndless(World.GRASSLANDS, 0.6f);
|
||||
background.changeTexture(World.ICY_MOUNTAINS.getBackgroundTexture());
|
||||
|
||||
player.init(PlayerShape.BALL, 0.6f, 0.5f, 0.5f, particleSystem);
|
||||
uncategorizedEntities.add(player);
|
||||
// terrain.createEndless(World.GRASSLANDS, 0.6f);
|
||||
// background.changeTexture(World.ICY_MOUNTAINS.getBackgroundTexture());
|
||||
//
|
||||
// player.init(PlayerShape.BALL, 0.6f, 0.5f, 0.5f, particleSystem);
|
||||
// uncategorizedEntities.add(player);
|
||||
uncategorizedEntities.add(new Entity(World.GRASSLANDS.getBackgroundTexture(), new Vector(), 1, 1));
|
||||
}
|
||||
}
|
@ -180,11 +180,7 @@ public class GameRenderer implements GLSurfaceView.Renderer {
|
||||
entityShader.loadTransformationMatrix(matrixCreator, entity);
|
||||
entityShader.loadAlpha(entity.getAlpha());
|
||||
entityShader.loadTextureAtlasInfos(entity.getTexture(), entity.getTextureAtlasIndex());
|
||||
float texScaleX = entity.getMaxTexSize().x == 0 ? 1 : entity.getWidth() / entity
|
||||
.getMaxTexSize().x;
|
||||
float texScaleY = entity.getMaxTexSize().y == 0 ? 1 : entity.getHeight() / entity
|
||||
.getMaxTexSize().y;
|
||||
entityShader.loadTexCoordScaling(texScaleX, texScaleY);
|
||||
entityShader.loadTexCoordScaling(entity.calcTexScaleX(), entity.calcTexScaleY());
|
||||
quad.draw();
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class ToolButtonBar implements View.OnClickListener{
|
||||
} else if (v.equals(button4) && !buttons.get(3).isLocked()) {
|
||||
clickedButton = buttons.get(3);
|
||||
}
|
||||
if (clickedButton != null) {
|
||||
if (clickedButton != null && clickedButton.getToolType() != null) {
|
||||
game.setCurrentTool(clickedButton.getToolType(), clickedButton.finishedLoading());
|
||||
setActive(clickedButton.getToolType());
|
||||
}
|
||||
|
Reference in New Issue
Block a user