Java Code Examples for org.andengine.entity.sprite.Sprite#COLOR_INDEX

The following examples show how to use org.andengine.entity.sprite.Sprite#COLOR_INDEX . 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: HighPerformanceTiledSpriteVertexBufferObject.java    From tilt-game-android with MIT License 6 votes vote down vote up
@Override
public void onUpdateColor(final TiledSprite pTiledSprite) {
	final float[] bufferData = this.mBufferData;

	final float packedColor = pTiledSprite.getColor().getABGRPackedFloat();

	final int tileCount = pTiledSprite.getTileCount();
	int bufferDataOffset = 0;
	for (int i = 0; i < tileCount; i++) {
		bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;

		bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
	}

	this.setDirtyOnHardware();
}
 
Example 2
Source File: HighPerformanceTiledSpriteVertexBufferObject.java    From 30-android-libraries-in-30-days with Apache License 2.0 6 votes vote down vote up
@Override
public void onUpdateColor(final TiledSprite pTiledSprite) {
	final float[] bufferData = this.mBufferData;

	final float packedColor = pTiledSprite.getColor().getABGRPackedFloat();

	final int tileCount = pTiledSprite.getTileCount();
	int bufferDataOffset = 0;
	for(int i = 0; i < tileCount; i++) {
		bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
		bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;

		bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE;
	}

	this.setDirtyOnHardware();
}
 
Example 3
Source File: HighPerformanceSpriteVertexBufferObject.java    From tilt-game-android with MIT License 5 votes vote down vote up
@Override
public void onUpdateColor(final Sprite pSprite) {
	final float[] bufferData = this.mBufferData;

	final float packedColor = pSprite.getColor().getABGRPackedFloat();

	bufferData[0 * Sprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
	bufferData[1 * Sprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
	bufferData[2 * Sprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
	bufferData[3 * Sprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;

	this.setDirtyOnHardware();
}
 
Example 4
Source File: HighPerformanceSpriteVertexBufferObject.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
@Override
public void onUpdateColor(final Sprite pSprite) {
	final float[] bufferData = this.mBufferData;

	final float packedColor = pSprite.getColor().getABGRPackedFloat();

	bufferData[0 * Sprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
	bufferData[1 * Sprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
	bufferData[2 * Sprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;
	bufferData[3 * Sprite.VERTEX_SIZE + Sprite.COLOR_INDEX] = packedColor;

	this.setDirtyOnHardware();
}