Fixed some bugs
This commit is contained in:
parent
1010ddf46d
commit
292c6cf08f
@ -302,12 +302,12 @@ public final class R {
|
||||
public static final int secondary_text_default_material_light = 0x7f05004d;
|
||||
public static final int secondary_text_disabled_material_dark = 0x7f05004e;
|
||||
public static final int secondary_text_disabled_material_light = 0x7f05004f;
|
||||
public static final int switch_thumb_disabled_material_dark = 0x7f050050;
|
||||
public static final int switch_thumb_disabled_material_light = 0x7f050051;
|
||||
public static final int switch_thumb_material_dark = 0x7f050052;
|
||||
public static final int switch_thumb_material_light = 0x7f050053;
|
||||
public static final int switch_thumb_normal_material_dark = 0x7f050054;
|
||||
public static final int switch_thumb_normal_material_light = 0x7f050055;
|
||||
public static final int switch_thumb_disabled_material_dark = 0x7f050051;
|
||||
public static final int switch_thumb_disabled_material_light = 0x7f050052;
|
||||
public static final int switch_thumb_material_dark = 0x7f050053;
|
||||
public static final int switch_thumb_material_light = 0x7f050054;
|
||||
public static final int switch_thumb_normal_material_dark = 0x7f050055;
|
||||
public static final int switch_thumb_normal_material_light = 0x7f050056;
|
||||
}
|
||||
public static final class dimen {
|
||||
public static final int abc_action_bar_content_inset_material = 0x7f060000;
|
||||
|
@ -350,7 +350,7 @@
|
||||
</obstacleData>
|
||||
</obstacles>
|
||||
<stars class="java.util.ArrayList">
|
||||
<positionData x="2.7666652" y="0.14000021"/>
|
||||
<positionData x="2.7733319" y="0.4"/>
|
||||
<positionData x="6.406662" y="-0.4599995"/>
|
||||
<positionData x="14.950134" y="0.7333332"/>
|
||||
</stars>
|
||||
|
File diff suppressed because one or more lines are too long
@ -326,17 +326,18 @@ int color secondary_text_default_material_dark 0x7f05004c
|
||||
int color secondary_text_default_material_light 0x7f05004d
|
||||
int color secondary_text_disabled_material_dark 0x7f05004e
|
||||
int color secondary_text_disabled_material_light 0x7f05004f
|
||||
int color switch_thumb_disabled_material_dark 0x7f050050
|
||||
int color switch_thumb_disabled_material_light 0x7f050051
|
||||
int color switch_thumb_material_dark 0x7f050052
|
||||
int color switch_thumb_material_light 0x7f050053
|
||||
int color switch_thumb_normal_material_dark 0x7f050054
|
||||
int color switch_thumb_normal_material_light 0x7f050055
|
||||
int color toolslotDisabled 0x7f050056
|
||||
int color toolslotDisabledSelected 0x7f050057
|
||||
int color toolslotEnabled 0x7f050058
|
||||
int color toolslotEnabledSelected 0x7f050059
|
||||
int color transparent 0x7f05005a
|
||||
int color settings_button_disabled 0x7f050050
|
||||
int color switch_thumb_disabled_material_dark 0x7f050051
|
||||
int color switch_thumb_disabled_material_light 0x7f050052
|
||||
int color switch_thumb_material_dark 0x7f050053
|
||||
int color switch_thumb_material_light 0x7f050054
|
||||
int color switch_thumb_normal_material_dark 0x7f050055
|
||||
int color switch_thumb_normal_material_light 0x7f050056
|
||||
int color toolslotDisabled 0x7f050057
|
||||
int color toolslotDisabledSelected 0x7f050058
|
||||
int color toolslotEnabled 0x7f050059
|
||||
int color toolslotEnabledSelected 0x7f05005a
|
||||
int color transparent 0x7f05005b
|
||||
int dimen abc_action_bar_content_inset_material 0x7f060000
|
||||
int dimen abc_action_bar_default_height_material 0x7f060001
|
||||
int dimen abc_action_bar_default_padding_end_material 0x7f060002
|
||||
|
@ -350,7 +350,7 @@
|
||||
</obstacleData>
|
||||
</obstacles>
|
||||
<stars class="java.util.ArrayList">
|
||||
<positionData x="2.7666652" y="0.14000021"/>
|
||||
<positionData x="2.7733319" y="0.4"/>
|
||||
<positionData x="6.406662" y="-0.4599995"/>
|
||||
<positionData x="14.950134" y="0.7333332"/>
|
||||
</stars>
|
||||
|
@ -8,7 +8,6 @@ import android.content.res.Configuration;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.RelativeLayout;
|
||||
@ -169,6 +168,12 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
|
||||
}
|
||||
}
|
||||
|
||||
public void flipToScreenNonUiThreaded(final Screen.ScreenType screen) {
|
||||
if (screen != Screen.ScreenType.NONE && flipper.getCurrentScreen().getType() != screen) {
|
||||
flipper.showScreen(screen, flipper.getCurrentScreen().getType());
|
||||
}
|
||||
}
|
||||
|
||||
public void onSurfaceChanged() {
|
||||
if (flipper.getCurrentScreen().getType() == Screen.ScreenType.PRE_START)
|
||||
flipToScreen(Screen.ScreenType.START);
|
||||
@ -346,8 +351,4 @@ public class GameActivity extends Activity implements ExceptionHandler, User.LvU
|
||||
public TutorialManager getTutorialManager() {
|
||||
return tutorialManager;
|
||||
}
|
||||
|
||||
public GameScreen getGameScreen() {
|
||||
return gameScreen;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class MyGlSurfaceView extends GLSurfaceView {
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
renderer.getCurrentRendering().onTouch(event.getX(), event.getY());
|
||||
renderer.onTouch(event.getX(), event.getY());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -12,10 +12,12 @@ import de.frajul.endlessroll.rendering.renderer.GameRenderer;
|
||||
*/
|
||||
public abstract class GLScreen<V extends ViewGroup> extends Screen<V> {
|
||||
|
||||
protected MyGlSurfaceView myGlSurfaceView;
|
||||
protected GameRenderer gameRenderer;
|
||||
|
||||
public GLScreen(ScreenType type, GameActivity gameActivity, @LayoutRes int layoutId, MyGlSurfaceView glView) {
|
||||
super(type, gameActivity, layoutId);
|
||||
this.myGlSurfaceView = glView;
|
||||
this.gameRenderer = glView.getRenderer();
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,10 @@ public class GameScreen extends GLScreen<RelativeLayout> {
|
||||
|
||||
@Override
|
||||
public void prepareToBeShown() {
|
||||
gameActivity.getSoundManager().menuMusic.stop();
|
||||
|
||||
gameRenderer.setCurrentRendering(game);
|
||||
game.getViewManager().prepareToBeShown();
|
||||
|
||||
gameActivity.getSoundManager().menuMusic.stop();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
@ -76,8 +76,8 @@ public class GameScreen extends GLScreen<RelativeLayout> {
|
||||
|
||||
@Override
|
||||
public void toScreen(ScreenType screen) {
|
||||
gameRenderer.setCurrentRendering(null);
|
||||
gameActivity.flipToScreen(screen);
|
||||
gameRenderer.setCurrentRendering(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -11,6 +11,7 @@ import de.frajul.endlessroll.R;
|
||||
import de.frajul.endlessroll.main.GameActivity;
|
||||
import de.frajul.endlessroll.main.MyGlSurfaceView;
|
||||
import de.frajul.endlessroll.main.game.StartScene;
|
||||
import de.frajul.endlessroll.main.game.Timer;
|
||||
import de.frajul.endlessroll.sqlDatabase.MyDatabase;
|
||||
import de.frajul.endlessroll.views.ConfirmDialog;
|
||||
|
||||
@ -57,11 +58,11 @@ public class StartScreen extends GLScreen<RelativeLayout> implements View.OnClic
|
||||
|
||||
@Override
|
||||
public void prepareToBeShown() {
|
||||
gameActivity.getSoundManager().menuMusic.start();
|
||||
|
||||
((StartScene) rendering.getScene()).randomizeWorld();
|
||||
((StartScene) rendering.getScene()).loadTexturesForCurrentWorld();
|
||||
gameRenderer.setCurrentRendering(rendering);
|
||||
|
||||
gameActivity.getSoundManager().menuMusic.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -37,6 +37,7 @@ import de.frajul.endlessroll.rendering.shader.TerrainShader;
|
||||
public class GameRenderer implements GLSurfaceView.Renderer {
|
||||
|
||||
private List<Rendering> renderTargets = new ArrayList<>();
|
||||
private final Object currentRenderingLock = new Object();
|
||||
private Rendering currentRendering;
|
||||
private MatrixCreator matrixCreator;
|
||||
|
||||
@ -60,22 +61,27 @@ public class GameRenderer implements GLSurfaceView.Renderer {
|
||||
particleRenderer = new ParticleRenderer(activity, quad, matrixCreator);
|
||||
}
|
||||
|
||||
public void addRenderTarget(Rendering renderTarget){
|
||||
public void addRenderTarget(Rendering renderTarget) {
|
||||
renderTargets.add(renderTarget);
|
||||
}
|
||||
|
||||
public void setCurrentRendering(Rendering currentRendering) {
|
||||
this.currentRendering = currentRendering;
|
||||
synchronized (currentRenderingLock) {
|
||||
this.currentRendering = currentRendering;
|
||||
}
|
||||
}
|
||||
|
||||
public Rendering getCurrentRendering() {
|
||||
return currentRendering;
|
||||
public void onTouch(float x, float y) {
|
||||
synchronized (currentRenderingLock) {
|
||||
if(currentRendering != null)
|
||||
currentRendering.onTouch(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
|
||||
GameLog.d("onSurfaceCreated");
|
||||
GLES20.glClearColor(1, 1, 1, 1.0f);
|
||||
GLES20.glClearColor(1, 0, 1, 1.0f);
|
||||
gl.glEnable(GL10.GL_BLEND);
|
||||
gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
@ -91,7 +97,7 @@ public class GameRenderer implements GLSurfaceView.Renderer {
|
||||
} catch (Exception e) {
|
||||
activity.onException(e);
|
||||
}
|
||||
for(Rendering renderTarget : renderTargets)
|
||||
for (Rendering renderTarget : renderTargets)
|
||||
renderTarget.initiate(texturePack, timer);
|
||||
}
|
||||
|
||||
@ -101,7 +107,7 @@ public class GameRenderer implements GLSurfaceView.Renderer {
|
||||
particleRenderer.createFbo(width, height);
|
||||
GLES20.glViewport(0, 0, width, height);
|
||||
matrixCreator.setMVPMSize(width, height);
|
||||
for(Rendering renderTarget : renderTargets)
|
||||
for (Rendering renderTarget : renderTargets)
|
||||
renderTarget.setScreenSize(width, height);
|
||||
activity.onSurfaceChanged();
|
||||
}
|
||||
@ -109,27 +115,29 @@ public class GameRenderer implements GLSurfaceView.Renderer {
|
||||
@Override
|
||||
public synchronized void onDrawFrame(GL10 gl) {
|
||||
timer.update();
|
||||
if (currentRendering != null) {
|
||||
currentRendering.update();
|
||||
Scene scene = currentRendering.getScene();
|
||||
synchronized (currentRenderingLock) {
|
||||
if (currentRendering != null) {
|
||||
currentRendering.update();
|
||||
Scene scene = currentRendering.getScene();
|
||||
|
||||
particleRenderer.renderParticlesToFbo(gl, scene);
|
||||
particleRenderer.renderParticlesToFbo(gl, scene);
|
||||
|
||||
GLES20.glClearColor(1, 1, 1, 1.0f);
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
GLES20.glClearColor(1, 1, 1, 1.0f);
|
||||
GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
|
||||
|
||||
renderBackground(gl, scene);
|
||||
renderTileList(gl, scene.getTerrain(), scene);
|
||||
renderTileList(gl, scene.getCeiling(), scene);
|
||||
renderEntityList(gl, scene.getCollectables(), scene.getCamera());
|
||||
renderObstacles(gl, scene);
|
||||
renderEntityList(gl, scene.getTools(), scene.getCamera());
|
||||
renderBackground(gl, scene);
|
||||
renderTileList(gl, scene.getTerrain(), scene);
|
||||
renderTileList(gl, scene.getCeiling(), scene);
|
||||
renderEntityList(gl, scene.getCollectables(), scene.getCamera());
|
||||
renderObstacles(gl, scene);
|
||||
renderEntityList(gl, scene.getTools(), scene.getCamera());
|
||||
|
||||
renderEntityList(gl, scene.getUncategorizedEntities(), scene.getCamera());
|
||||
renderEntityList(gl, scene.getUncategorizedEntities(), scene.getCamera());
|
||||
|
||||
renderFbo(gl);
|
||||
renderFbo(gl);
|
||||
|
||||
renderGuis(gl, scene.getGuis());
|
||||
renderGuis(gl, scene.getGuis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_pressed="true">
|
||||
<item android:state_pressed="true" android:state_enabled="true">
|
||||
<shape>
|
||||
<solid android:color="@color/secondary_much_transparent"/>
|
||||
<corners android:radius="5dp"/>
|
||||
@ -11,7 +11,7 @@
|
||||
<stroke android:width="1dp" android:color="@color/secondary_dark"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_pressed="false">
|
||||
<item android:state_pressed="false" android:state_enabled="true">
|
||||
<shape>
|
||||
<solid android:color="@color/transparent"/>
|
||||
<corners android:radius="5dp"/>
|
||||
@ -22,4 +22,15 @@
|
||||
<stroke android:width="1dp" android:color="@color/secondary_dark"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape>
|
||||
<solid android:color="@color/settings_button_disabled"/>
|
||||
<corners android:radius="5dp"/>
|
||||
<padding android:right="5dp"
|
||||
android:left="5dp"
|
||||
android:top="5dp"
|
||||
android:bottom="5dp"/>
|
||||
<stroke android:width="1dp" android:color="@color/secondary_dark"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -15,6 +15,7 @@
|
||||
<color name="transparent">#00000000</color>
|
||||
|
||||
<color name="message_buttons">#daf10d</color>
|
||||
<color name="settings_button_disabled">#c7b7b7b7</color>
|
||||
|
||||
<color name="toolslotDisabled">#715f5f</color>
|
||||
<color name="toolslotDisabledSelected">#60715f</color>
|
||||
|
Loading…
x
Reference in New Issue
Block a user