Commit fe5a774c authored by Luboš Horáček's avatar Luboš Horáček

#60 odstraneni padani diky soubehu konkurencnich operaci

parent 9b774464
......@@ -34,13 +34,13 @@ public class RenderSurfaceView extends GLSurfaceView implements IResolutionPolic
public RenderSurfaceView(final Context pContext) {
super(pContext);
this.setEGLContextClientVersion(2);
setEGLContextClientVersion(2);
}
public RenderSurfaceView(final Context pContext, final AttributeSet pAttrs) {
super(pContext, pAttrs);
this.setEGLContextClientVersion(2);
setEGLContextClientVersion(2);
}
// ===========================================================
......@@ -48,10 +48,10 @@ public class RenderSurfaceView extends GLSurfaceView implements IResolutionPolic
// ===========================================================
public ConfigChooser getConfigChooser() throws IllegalStateException {
if (this.mConfigChooser == null) {
if (mConfigChooser == null) {
throw new IllegalStateException(ConfigChooser.class.getSimpleName() + " not yet set.");
}
return this.mConfigChooser;
return mConfigChooser;
}
// ===========================================================
......@@ -63,12 +63,12 @@ public class RenderSurfaceView extends GLSurfaceView implements IResolutionPolic
*/
@Override
protected void onMeasure(final int pWidthMeasureSpec, final int pHeightMeasureSpec) {
this.mEngineRenderer.mEngine.getEngineOptions().getResolutionPolicy().onMeasure(this, pWidthMeasureSpec, pHeightMeasureSpec);
mEngineRenderer.mEngine.getEngineOptions().getResolutionPolicy().onMeasure(this, pWidthMeasureSpec, pHeightMeasureSpec);
}
@Override
public void onResolutionChanged(final int pWidth, final int pHeight) {
this.setMeasuredDimension(pWidth, pHeight);
setMeasuredDimension(pWidth, pHeight);
}
// ===========================================================
......@@ -76,22 +76,22 @@ public class RenderSurfaceView extends GLSurfaceView implements IResolutionPolic
// ===========================================================
public void setRenderer(final Engine pEngine, final IRendererListener pRendererListener) {
if (this.mConfigChooser == null) {
if (mConfigChooser == null) {
final ConfigChooserOptions configChooserOptions = pEngine.getEngineOptions().getRenderOptions().getConfigChooserOptions();
this.mConfigChooser = new ConfigChooser(configChooserOptions);
mConfigChooser = new ConfigChooser(configChooserOptions);
// TODO We don't know yet if the requested color size will actually be accepted!
if (configChooserOptions.isRequestedRGBA8888()) {
this.getHolder().setFormat(android.graphics.PixelFormat.RGBA_8888);
getHolder().setFormat(android.graphics.PixelFormat.RGBA_8888);
} else if (configChooserOptions.isRequestedRGB565()) {
this.getHolder().setFormat(android.graphics.PixelFormat.RGB_565);
getHolder().setFormat(android.graphics.PixelFormat.RGB_565);
}
}
this.setEGLConfigChooser(this.mConfigChooser);
this.setEGLConfigChooser(mConfigChooser);
this.setOnTouchListener(pEngine);
this.mEngineRenderer = new EngineRenderer(pEngine, this.mConfigChooser, pRendererListener);
this.setRenderer(this.mEngineRenderer);
setOnTouchListener(pEngine);
mEngineRenderer = new EngineRenderer(pEngine, mConfigChooser, pRendererListener);
this.setRenderer(mEngineRenderer);
}
// ===========================================================
......
......@@ -26,16 +26,18 @@
android:layout_height="match_parent" >
<!-- MAIN SCREEN -->
<RelativeLayout
android:id="@+id/gameScreen"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<org.andengine.opengl.view.RenderSurfaceView
android:id="@+id/gameSurfaceView"
<FrameLayout
android:id="@+id/renderViewParent"
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_height="match_parent" >
</FrameLayout>
<FrameLayout
android:id="@+id/gamePanelLayout"
android:layout_width="match_parent"
......@@ -44,18 +46,16 @@
<include
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
layout="@layout/victoryscreen" />
layout="@layout/victoryscreen"
android:visibility="gone" />
<include
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
layout="@layout/gameloading" />
<include
layout="@layout/tablexia_contenthider_fragment"/>
layout="@layout/gameloading"
android:visibility="gone" />
<include layout="@layout/tablexia_contenthider_fragment" />
</RelativeLayout>
<!-- MAIN MENU -->
......@@ -72,7 +72,7 @@
<include
android:id="@+id/mainmenu_rightborder"
layout="@layout/menu_rightborder"/>
layout="@layout/menu_rightborder" />
<FrameLayout
android:layout_width="match_parent"
......@@ -82,4 +82,4 @@
<!-- Transparent layer to fix fragment overlapping -->
</FrameLayout>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
......@@ -126,6 +126,7 @@ public abstract class GameActivity extends LayoutGameActivity implements MenuAct
protected RelativeLayout victoryLayout;
private FrameLayout loadindScreen;
private ViewGroup gamePanelLayout;
private FrameLayout renderViewParent;
private ImageButton loadingScreenButton;
......@@ -157,7 +158,6 @@ public abstract class GameActivity extends LayoutGameActivity implements MenuAct
@Override
protected void onSetContentView() {
// do nothing until mounted
setContentView(getLayoutID());
}
......@@ -365,13 +365,15 @@ public abstract class GameActivity extends LayoutGameActivity implements MenuAct
getTablexiaContext().hideScreenContentFast(false);
gameState = GameState.IDLE;
renderViewParent = (FrameLayout) findViewById(R.id.renderViewParent);
// menu drawer
menuDrawer = (TablexiaDrawerLayout) findViewById(R.id.drawer_layout);
menuDrawer.addDrawerListener(this);
gamePanelLayout = (ViewGroup) findViewById(R.id.gamePanelLayout);
prepareLoadingScreen();
prepareVictoryScreen();
// restore saved state
afterResume = false;
if (savedInstanceState != null) {
......@@ -398,11 +400,13 @@ public abstract class GameActivity extends LayoutGameActivity implements MenuAct
runOnUiThread(new Runnable() {
@Override
public void run() {
prepareLoadingScreen();
prepareVictoryScreen();
showLoadingScreen();
mRenderSurfaceView = (RenderSurfaceView) findViewById(getRenderSurfaceViewID());
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);
RenderSurfaceView renderSurfaceView = new RenderSurfaceView(GameActivity.this);
renderSurfaceView.setId(R.id.gameSurfaceView);
renderViewParent.addView(renderSurfaceView, params);
mRenderSurfaceView = renderSurfaceView;
mRenderSurfaceView.setRenderer(mEngine, GameActivity.this);
showLoadingScreen();
}
});
}
......
......@@ -264,8 +264,10 @@ public class StrelniceActivity extends GameActivity implements OnFlowerAreaTouch
private void toggleFlowers(List<Target> targets, FlowerToggle operation) {
for (Target target : targets) {
target.setScaleCenterY(0);
target.registerEntityModifier(operation == FlowerToggle.SHOW ? new ScaleModifier(0.3f, 1, 1, 0, 1) : new ParallelEntityModifier(new ScaleModifier(0.3f, 1, 1, 1, 0), new MoveByModifier(0.3f, 0, -target.getHeight() / 2)));
if (target.getParent() != null) {
target.setScaleCenterY(0);
target.registerEntityModifier(operation == FlowerToggle.SHOW ? new ScaleModifier(0.3f, 1, 1, 0, 1) : new ParallelEntityModifier(new ScaleModifier(0.3f, 1, 1, 1, 0), new MoveByModifier(0.3f, 0, -target.getHeight() / 2)));
}
}
}
......@@ -276,8 +278,8 @@ public class StrelniceActivity extends GameActivity implements OnFlowerAreaTouch
scene.registerUpdateHandler(new TimerHandler(1.5f, false, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
toggleFlowers(targets, FlowerToggle.SHOW);
targetPositionUpdateHandler.onUpdate(0);
toggleFlowers(targets, FlowerToggle.SHOW);
}
}));
......@@ -299,21 +301,21 @@ public class StrelniceActivity extends GameActivity implements OnFlowerAreaTouch
public void onTimeOver() {
toggleFlowers(targets, FlowerToggle.HIDE);
mfxManager.playSound(SoundType.BELL);
watchHand.registerEntityModifier(new LoopEntityModifier(new SequenceEntityModifier(new AlphaModifier(0.25f, 1, 0), new AlphaModifier(0.25f, 0, 1))));
watchHand.registerEntityModifier(new LoopEntityModifier(new SequenceEntityModifier(new AlphaModifier(0.15f, 1, 0), new AlphaModifier(0.15f, 0, 1))));
scene.unregisterUpdateHandler(targetPositionUpdateHandler); // přestaneme hýbat květinama
watchHand.unregisterEntityModifiers(new IEntityModifierMatcher() {
@Override
public boolean matches(IModifier<IEntity> pItem) {
return true;
}
});
watchHand.setAlpha(1);
watchHand.setRotation(0);
toggleCarousel();
scene.registerUpdateHandler(new TimerHandler(1f, false, new ITimerCallback() {
@Override
public void onTimePassed(final TimerHandler pTimerHandler) {
watchHand.unregisterEntityModifiers(new IEntityModifierMatcher() {
@Override
public boolean matches(IModifier<IEntity> pItem) {
return true;
}
});
watchHand.setAlpha(1);
toggleEntity(watch);
toggleEntity(scoreText);
gameComplete();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment