org.andengine.entity.Entity Java Examples

The following examples show how to use org.andengine.entity.Entity. 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: BatchedPseudoSpriteParticleSystem.java    From tilt-game-android with MIT License 6 votes vote down vote up
@Override
protected void onManagedDraw(final GLState pGLState, final Camera pCamera) {
	this.mSpriteBatch.setIndex(0);

	final Particle<Entity>[] particles = this.mParticles;
	for (int i = this.mParticlesAlive - 1; i >= 0; i--) {
		final Entity entity = particles[i].getEntity();

		/* In order to support alpha changes of the sprites inside the spritebatch,
		 * we have to 'premultiply' the RGB channels of the sprite with its alpha channel. */
		final float alpha = entity.getAlpha();
		final float colorABGRPackedInt = ColorUtils.convertRGBAToABGRPackedFloat(entity.getRed() * alpha, entity.getGreen() * alpha, entity.getBlue() * alpha, alpha);

		this.mSpriteBatch.drawWithoutChecks(this.mTextureRegion, entity, colorABGRPackedInt);
	}
	this.mSpriteBatch.submit();

	this.mSpriteBatch.onDraw(pGLState, pCamera);
}
 
Example #2
Source File: BatchedPseudoSpriteParticleSystem.java    From 30-android-libraries-in-30-days with Apache License 2.0 6 votes vote down vote up
@Override
protected void onManagedDraw(final GLState pGLState, final Camera pCamera) {
	this.mSpriteBatch.setIndex(0);

	final Particle<Entity>[] particles = this.mParticles;
	for(int i = this.mParticlesAlive - 1; i >= 0; i--) {
		final Entity entity = particles[i].getEntity();

		/* In order to support alpha changes of the sprites inside the spritebatch,
		 * we have to 'premultiply' the RGB channels of the sprite with its alpha channel. */
		final float alpha = entity.getAlpha();
		final float colorABGRPackedInt = ColorUtils.convertRGBAToABGRPackedFloat(entity.getRed() * alpha, entity.getGreen() * alpha, entity.getBlue() * alpha, alpha);

		this.mSpriteBatch.drawWithoutChecks(this.mTextureRegion, entity, this.mTextureRegion.getWidth(), this.mTextureRegion.getHeight(), colorABGRPackedInt);
	}
	this.mSpriteBatch.submit();

	this.mSpriteBatch.onDraw(pGLState, pCamera);
}
 
Example #3
Source File: LevelChoiceScene.java    From sopa with Apache License 2.0 5 votes vote down vote up
private void addChangeLevelButtons() {

        int screenCount = ((int) (levelInfos.size() - 0.1) / 12) + 1;
        rightArrow = new ButtonSprite(camera.getWidth() * 0.93f - LEVEL_SELECT_ICON_WIDTH, camera.getHeight() * 0.8f,
                resourcesManager.levelChoiceArrowRightRegion, vbom, new ButtonSprite.OnClickListener() {

                    @Override
                    public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) {

                        levelChoiceService.moveRight();
                    }
                });
        leftArrow = new ButtonSprite(camera.getWidth() * 0.07f, camera.getHeight() * 0.8f,
                resourcesManager.levelChoiceArrowLeftRegion, vbom, new ButtonSprite.OnClickListener() {

                    @Override
                    public void onClick(ButtonSprite pButtonSprite, float pTouchAreaLocalX, float pTouchAreaLocalY) {

                        levelChoiceService.moveLeft();
                    }
                });

        leftArrow.setVisible(false);

        if (screenCount == 1) {
            rightArrow.setVisible(false);
        }

        arrowHud = new HUD();
        arrowHud.attachChild(leftArrow);
        arrowHud.attachChild(rightArrow);
        arrowHud.registerTouchArea(leftArrow);
        arrowHud.registerTouchArea(rightArrow);
        camera.setHUD(arrowHud);
        entityToFollow = new Entity(camera.getWidth() / 2, camera.getHeight() / 2);
        attachChild(entityToFollow);
        camera.setChaseEntity(entityToFollow);
    }
 
Example #4
Source File: RenderOfFixture.java    From tilt-game-android with MIT License 4 votes vote down vote up
@Override
public Entity getEntity() {
	return mEntity;
}
 
Example #5
Source File: RenderOfJoint.java    From tilt-game-android with MIT License 4 votes vote down vote up
@Override
public Entity getEntity() {
	return mEntity;
}
 
Example #6
Source File: Scene.java    From tilt-game-android with MIT License 4 votes vote down vote up
@Deprecated
public Scene(final int pChildCount) {
	for (int i = 0; i < pChildCount; i++) {
		this.attachChild(new Entity());
	}
}
 
Example #7
Source File: Scene.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
@Deprecated
public Scene(final int pChildCount) {
	for(int i = 0; i < pChildCount; i++) {
		this.attachChild(new Entity());
	}
}
 
Example #8
Source File: RectangularShapeCollisionChecker.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public static boolean checkContains(final Entity pEntity, final float pLocalWidth, final float pLocalHeight, final float pX, final float pY) {
	RectangularShapeCollisionChecker.fillVertices(pEntity.getX(), pEntity.getY(), pLocalWidth, pLocalHeight, pEntity.getLocalToSceneTransformation(), RectangularShapeCollisionChecker.VERTICES_CONTAINS_TMP);
	return ShapeCollisionChecker.checkContains(RectangularShapeCollisionChecker.VERTICES_CONTAINS_TMP, RectangularShapeCollisionChecker.RECTANGULARSHAPE_VERTEX_COUNT, pX, pY);
}
 
Example #9
Source File: LevelChoiceSceneSwipeDetector.java    From sopa with Apache License 2.0 2 votes vote down vote up
protected LevelChoiceSceneSwipeDetector(Entity entityToFollow) {

        this.entityToFollow = entityToFollow;
    }
 
Example #10
Source File: IRenderOfJoint.java    From tilt-game-android with MIT License votes vote down vote up
public Entity getEntity(); 
Example #11
Source File: IRenderOfFixture.java    From tilt-game-android with MIT License votes vote down vote up
public Entity getEntity();