org.andengine.entity.scene.Scene Java Examples
The following examples show how to use
org.andengine.entity.scene.Scene.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LevelModeCompleteScene.java From sopa with Apache License 2.0 | 6 votes |
LevelModeCompleteScene() { Text levelCompleteTextShape = new Text((float) (camera.getWidth() * 0.05), (float) (camera.getHeight() * 0.05), resourcesManager.levelModeCompleteFont, "Level Mode\nCompleted", vbom); levelCompleteTextShape.setScaleCenter(0, 0); attachChild(levelCompleteTextShape); Sprite cup = new Sprite(0, 0, resourcesManager.levelModeCup, vbom); cup.setPosition(camera.getWidth() / 2 - cup.getWidth() / 2, camera.getHeight() * 0.4f); attachChild(cup); attachChild(new ConfettiParticleSystem(vbom, camera.getWidth())); setOnSceneTouchListener(new IOnSceneTouchListener() { @Override public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) { onBackKeyPressed(); return false; } }); }
Example #2
Source File: SimpleAsyncGameActivity.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
@Override public void onPopulateScene(final Scene pScene, final OnPopulateSceneCallback pOnPopulateSceneCallback) { this.runOnUiThread(new Runnable() { @Override public void run() { ActivityUtils.doProgressAsync(SimpleAsyncGameActivity.this, "Populating Scene...", android.R.drawable.ic_menu_rotate, new ProgressCallable<Void>() { @Override public Void call(final IProgressListener pProgressListener) throws Exception { SimpleAsyncGameActivity.this.onPopulateSceneAsync(pScene, pProgressListener); pProgressListener.onProgressChanged(100); pOnPopulateSceneCallback.onPopulateSceneFinished(); return null; } }, new Callback<Void>() { @Override public void onCallback(final Void pCallbackValue) { /* Nothing. */ } }); } }); }
Example #3
Source File: SimpleAsyncGameActivity.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
@Override public void onCreateScene(final OnCreateSceneCallback pOnCreateSceneCallback) { this.runOnUiThread(new Runnable() { @Override public void run() { ActivityUtils.doProgressAsync(SimpleAsyncGameActivity.this, "Loading Scene...", android.R.drawable.ic_menu_rotate, new ProgressCallable<Void>() { @Override public Void call(final IProgressListener pProgressListener) throws Exception { final Scene scene = SimpleAsyncGameActivity.this.onCreateSceneAsync(pProgressListener); pProgressListener.onProgressChanged(100); pOnCreateSceneCallback.onCreateSceneFinished(scene); return null; } }, new Callback<Void>() { @Override public void onCallback(final Void pCallbackValue) { /* Nothing. */ } }); } }); }
Example #4
Source File: Engine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
@Override public boolean onTouchEvent(final TouchEvent pSurfaceTouchEvent) { /* * Let the engine determine which scene and camera this event should be * handled by. */ final Scene scene = this.getSceneFromSurfaceTouchEvent(pSurfaceTouchEvent); final Camera camera = this.getCameraFromSurfaceTouchEvent(pSurfaceTouchEvent); this.convertSurfaceToSceneTouchEvent(camera, pSurfaceTouchEvent); if(this.onTouchHUD(camera, pSurfaceTouchEvent)) { return true; } else { /* If HUD didn't handle it, Scene may handle it. */ return this.onTouchScene(scene, pSurfaceTouchEvent); } }
Example #5
Source File: AndEngineActivity.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
@Override protected Scene onCreateScene() { Scene scene = new Scene(); scene.getBackground().setColor(0.2f, 0.5f, 0.7f); Sprite sprite = new Sprite(mCamera.getWidth() / 2, mCamera.getHeight() / 2, mTextureRegion, getVertexBufferObjectManager()); scene.attachChild(sprite); mAnimatedSprite = new AnimatedSprite(200, 200, mTiledTextureRegion, this.getVertexBufferObjectManager()); long[] frameDuration = {500, 500, 500, 500}; mAnimatedSprite.animate(frameDuration); scene.attachChild(mAnimatedSprite); return scene; }
Example #6
Source File: SimpleAsyncGameActivity.java From tilt-game-android with MIT License | 6 votes |
@Override public void onPopulateScene(final Scene pScene, final OnPopulateSceneCallback pOnPopulateSceneCallback) { this.runOnUiThread(new Runnable() { @Override public void run() { ActivityUtils.doProgressAsync(SimpleAsyncGameActivity.this, "Populating Scene...", android.R.drawable.ic_menu_rotate, new ProgressCallable<Void>() { @Override public Void call(final IProgressListener pProgressListener) throws Exception { SimpleAsyncGameActivity.this.onPopulateSceneAsync(pScene, pProgressListener); pProgressListener.onProgressChanged(100); pOnPopulateSceneCallback.onPopulateSceneFinished(); return null; } }, new Callback<Void>() { @Override public void onCallback(final Void pCallbackValue) { /* Nothing. */ } }); } }); }
Example #7
Source File: SimpleAsyncGameActivity.java From tilt-game-android with MIT License | 6 votes |
@Override public void onCreateScene(final OnCreateSceneCallback pOnCreateSceneCallback) { this.runOnUiThread(new Runnable() { @Override public void run() { ActivityUtils.doProgressAsync(SimpleAsyncGameActivity.this, "Loading Scene...", android.R.drawable.ic_menu_rotate, new ProgressCallable<Void>() { @Override public Void call(final IProgressListener pProgressListener) throws Exception { final Scene scene = SimpleAsyncGameActivity.this.onCreateSceneAsync(pProgressListener); pProgressListener.onProgressChanged(100); pOnCreateSceneCallback.onCreateSceneFinished(scene); return null; } }, new Callback<Void>() { @Override public void onCallback(final Void pCallbackValue) { /* Nothing. */ } }); } }); }
Example #8
Source File: GameActivity.java From sopa with Apache License 2.0 | 5 votes |
@Override public void onPopulateScene(Scene pScene, OnPopulateSceneCallback pOnPopulateSceneCallback) throws Exception { mEngine.registerUpdateHandler(new TimerHandler(0.1f, new ITimerCallback() { @Override public void onTimePassed(final TimerHandler pTimerHandler) { mEngine.unregisterUpdateHandler(pTimerHandler); ResourcesManager.getInstance().storyService.createMenuScene(); } })); pOnPopulateSceneCallback.onPopulateSceneFinished(); }
Example #9
Source File: MenuScene.java From tilt-game-android with MIT License | 5 votes |
@Override public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) { if (this.mSelectedMenuItem != null) { this.mSelectedMenuItem.onUnselected(); this.mSelectedMenuItem = null; } return false; }
Example #10
Source File: FlipGameActivity.java From tilt-game-android with MIT License | 5 votes |
@Override public void onPopulateScene(final Scene pScene, OnPopulateSceneCallback pOnPopulateSceneCallback) throws IOException { pOnPopulateSceneCallback.onPopulateSceneFinished(); runOnUiThread(new Runnable() { @Override public void run() { createLevel(); } }); }
Example #11
Source File: MenuScene.java From tilt-game-android with MIT License | 5 votes |
@Override public void setChildScene(final Scene pChildScene, final boolean pModalDraw, final boolean pModalUpdate, final boolean pModalTouch) throws IllegalArgumentException { if (pChildScene instanceof MenuScene) { super.setChildScene(pChildScene, pModalDraw, pModalUpdate, pModalTouch); } else { throw new IllegalArgumentException("A " + MenuScene.class.getSimpleName() + " accepts only " + MenuScene.class.getSimpleName() + " as a ChildScene."); } }
Example #12
Source File: Engine.java From tilt-game-android with MIT License | 5 votes |
protected boolean onTouchScene(final Scene pScene, final TouchEvent pSceneTouchEvent) { if (pScene != null) { return pScene.onSceneTouchEvent(pSceneTouchEvent); } else { return false; } }
Example #13
Source File: BaseOnScreenControl.java From tilt-game-android with MIT License | 5 votes |
@Override public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) { final int pointerID = pSceneTouchEvent.getPointerID(); if (pointerID == this.mActivePointerID) { this.onHandleControlBaseLeft(); switch (pSceneTouchEvent.getAction()) { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: this.mActivePointerID = BaseOnScreenControl.INVALID_POINTER_ID; } } return false; }
Example #14
Source File: Engine.java From tilt-game-android with MIT License | 5 votes |
@Override public boolean onTouchEvent(final TouchEvent pSurfaceTouchEvent) { /* Let the engine determine which scene and camera this event should be handled by. */ final Scene scene = this.getSceneFromSurfaceTouchEvent(pSurfaceTouchEvent); final Camera camera = this.getCameraFromSurfaceTouchEvent(pSurfaceTouchEvent); this.convertSurfaceTouchEventToSceneTouchEvent(camera, pSurfaceTouchEvent); if (this.onTouchHUD(camera, pSurfaceTouchEvent)) { return true; } else { /* If HUD didn't handle it, Scene may handle it. */ return this.onTouchScene(scene, pSurfaceTouchEvent); } }
Example #15
Source File: FlipGameActivity.java From tilt-game-android with MIT License | 5 votes |
@Override public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) throws IOException { final Scene scene = new Scene(); scene.getBackground().setColor(ColorUtils.convertARGBPackedIntToColor(_backgroundColor)); _worldController = new WorldController(_cameraWidth, _cameraHeight, _scale, getResources().getDisplayMetrics().density, getEngine()); _worldController.setDoDebugDraw(BuildConfig.BOX2D_DEBUG); _worldController.setOrientationProvider(GoogleFlipGameApplication.getOrientationProvider(this), GoogleFlipGameApplication.getScreenRotation()); _worldController.setGameLevelStateListener(this); pOnCreateSceneCallback.onCreateSceneFinished(scene); }
Example #16
Source File: DoubleSceneSplitScreenEngine.java From tilt-game-android with MIT License | 5 votes |
@Override protected Scene getSceneFromSurfaceTouchEvent(final TouchEvent pTouchEvent) { if (pTouchEvent.getX() <= this.mSurfaceWidth >> 1) { return this.getFirstScene(); } else { return this.getSecondScene(); } }
Example #17
Source File: MenuScene.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
@Override public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) { if(this.mSelectedMenuItem != null) { this.mSelectedMenuItem.onUnselected(); this.mSelectedMenuItem = null; } return false; }
Example #18
Source File: BaseOnScreenControl.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
@Override public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) { final int pointerID = pSceneTouchEvent.getPointerID(); if(pointerID == this.mActivePointerID) { this.onHandleControlBaseLeft(); switch(pSceneTouchEvent.getAction()) { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: this.mActivePointerID = INVALID_POINTER_ID; } } return false; }
Example #19
Source File: Engine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
protected boolean onTouchScene(final Scene pScene, final TouchEvent pSceneTouchEvent) { if(pScene != null) { return pScene.onSceneTouchEvent(pSceneTouchEvent); } else { return false; } }
Example #20
Source File: DoubleSceneSplitScreenEngine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
@Override protected Scene getSceneFromSurfaceTouchEvent(final TouchEvent pTouchEvent) { if(pTouchEvent.getX() <= this.mSurfaceWidth >> 1) { return this.getFirstScene(); } else { return this.getSecondScene(); } }
Example #21
Source File: Bird.java From OpenFlappyBird with Do What The F*ck You Want To Public License | 5 votes |
public Bird(float birdXOffset, float birdYOffset, VertexBufferObjectManager mVertexBufferObjectManager, Scene mScene) { this.mBirdXOffset = birdXOffset; this.mBirdYOffset = birdYOffset; mSprite = new AnimatedSprite(mBirdXOffset, mBirdYOffset, 55.8f, 40, mBirdTextureRegion, mVertexBufferObjectManager); mSprite.animate(25); mSprite.setZIndex(2); mScene.attachChild(mSprite); }
Example #22
Source File: PipePair.java From OpenFlappyBird with Do What The F*ck You Want To Public License | 5 votes |
public PipePair(int mOpeningHeight, VertexBufferObjectManager mVertexBufferObjectManager, Scene mScene) { super(); this.mOpeningHeight = mOpeningHeight; this.mVertexBufferObjectManager = mVertexBufferObjectManager; this.mScene = mScene; // upper pipe mUpperPipe = new Sprite(PIPE_Y_OFFSET, mOpeningHeight-122, 88, 41, mUpperPipeTexture, mVertexBufferObjectManager); mUpperPipe.setZIndex(1); mScene.attachChild(mUpperPipe); mUpperPipeSection = new Sprite(PIPE_Y_OFFSET + 3, 0, 82, mOpeningHeight-122, mUpperPipeSectionTexture, mVertexBufferObjectManager); mUpperPipeSection.setZIndex(1); mScene.attachChild(mUpperPipeSection); //lower pipe mLowerPipe = new Sprite(PIPE_Y_OFFSET, mOpeningHeight+81, 88, 41, mLowerPipeTexture, mVertexBufferObjectManager); mLowerPipe.setZIndex(1); mScene.attachChild(mLowerPipe); mLowerPipeSection = new Sprite(PIPE_Y_OFFSET + 3, mOpeningHeight+122, 82, (644-(mOpeningHeight+122)), mLowerPipeSectionTexture, mVertexBufferObjectManager); mLowerPipeSection.setZIndex(1); mScene.attachChild(mLowerPipeSection); mScene.sortChildren(); }
Example #23
Source File: TutorialScene.java From sopa with Apache License 2.0 | 5 votes |
@Override public boolean onSceneTouchEvent(Scene pScene, TouchEvent pSceneTouchEvent) { if (pSceneTouchEvent.isActionDown()) { if (alreadySwitched == 0) { firstScreenA.setVisible(false); firstScreenB.setVisible(false); secondScreenA.setVisible(true); secondScreenB.setVisible(true); } else if (alreadySwitched == 1) { secondScreenA.setVisible(false); secondScreenB.setVisible(false); letsGo.setVisible(true); engine.registerUpdateHandler(new TimerHandler(1.5f, new ITimerCallback() { @Override public void onTimePassed(TimerHandler pTimerHandler) { engine.unregisterUpdateHandler(pTimerHandler); if (!leaveScene) { storyService.loadFirstLevelFromTutorial(); } } })); } alreadySwitched++; } return false; }
Example #24
Source File: MenuScene.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
@Override public void setChildScene(final Scene pChildScene, final boolean pModalDraw, final boolean pModalUpdate, final boolean pModalTouch) throws IllegalArgumentException { if(pChildScene instanceof MenuScene) { super.setChildScene(pChildScene, pModalDraw, pModalUpdate, pModalTouch); } else { throw new IllegalArgumentException("MenuScene accepts only MenuScenes as a ChildScene."); } }
Example #25
Source File: DoubleSceneSplitScreenEngine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public Scene getFirstScene() { return super.getScene(); }
Example #26
Source File: Engine.java From tilt-game-android with MIT License | 4 votes |
protected Scene getSceneFromSurfaceTouchEvent(final TouchEvent pTouchEvent) { return this.mScene; }
Example #27
Source File: DoubleSceneSplitScreenEngine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public void setSecondScene(final Scene pScene) { this.mSecondScene = pScene; }
Example #28
Source File: DoubleSceneSplitScreenEngine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
public void setFirstScene(final Scene pScene) { super.setScene(pScene); }
Example #29
Source File: DoubleSceneSplitScreenEngine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
@Deprecated @Override public void setScene(final Scene pScene) { this.setFirstScene(pScene); }
Example #30
Source File: Engine.java From 30-android-libraries-in-30-days with Apache License 2.0 | 4 votes |
protected Scene getSceneFromSurfaceTouchEvent(final TouchEvent pTouchEvent) { return this.mScene; }