Java Code Examples for org.andengine.entity.sprite.Sprite#VERTEX_INDEX_X
The following examples show how to use
org.andengine.entity.sprite.Sprite#VERTEX_INDEX_X .
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: HighPerformanceSpriteVertexBufferObject.java From tilt-game-android with MIT License | 6 votes |
@Override public void onUpdateVertices(final Sprite pSprite) { final float[] bufferData = this.mBufferData; final float width = pSprite.getWidth(); // TODO Optimize with field access? final float height = pSprite.getHeight(); // TODO Optimize with field access? bufferData[0 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0; bufferData[0 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0; bufferData[1 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0; bufferData[1 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height; bufferData[2 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width; bufferData[2 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0; bufferData[3 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width; bufferData[3 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height; this.setDirtyOnHardware(); }
Example 2
Source File: HighPerformanceDiamondSpriteVertexBufferObject.java From tilt-game-android with MIT License | 6 votes |
@Override public void onUpdateVertices(final Sprite pSprite) { final float[] bufferData = this.mBufferData; final float width = pSprite.getWidth(); // TODO Optimize with field access? final float height = pSprite.getHeight(); // TODO Optimize with field access? final float halfWidth = width * 0.5f; final float halfHeight = height * 0.5f; bufferData[0 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = halfWidth; bufferData[0 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0; bufferData[1 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0; bufferData[1 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = halfHeight; bufferData[2 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width; bufferData[2 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = halfHeight; bufferData[3 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = halfWidth; bufferData[3 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height; this.setDirtyOnHardware(); }
Example 3
Source File: HighPerformanceSpriteVertexBufferObject.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
@Override public void onUpdateVertices(final Sprite pSprite) { final float[] bufferData = this.mBufferData; final float x = 0; final float y = 0; final float x2 = pSprite.getWidth(); // TODO Optimize with field access? final float y2 = pSprite.getHeight(); // TODO Optimize with field access? bufferData[0 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x; bufferData[0 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y; bufferData[1 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x; bufferData[1 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2; bufferData[2 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2; bufferData[2 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y; bufferData[3 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2; bufferData[3 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2; this.setDirtyOnHardware(); }
Example 4
Source File: HighPerformanceDiamondSpriteVertexBufferObject.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
@Override public void onUpdateVertices(final Sprite pSprite) { final float[] bufferData = this.mBufferData; final float x = 0; final float y = 0; final float x2 = pSprite.getWidth(); // TODO Optimize with field access? final float y2 = pSprite.getHeight(); // TODO Optimize with field access? final float xCenter = (x + x2) * 0.5f; final float yCenter = (y + y2) * 0.5f; bufferData[0 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x; bufferData[0 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = yCenter; bufferData[1 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = xCenter; bufferData[1 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2; bufferData[2 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = xCenter; bufferData[2 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y; bufferData[3 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2; bufferData[3 * Sprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = yCenter; this.setDirtyOnHardware(); }
Example 5
Source File: HighPerformanceTiledSpriteVertexBufferObject.java From tilt-game-android with MIT License | 5 votes |
@Override public void onUpdateVertices(final TiledSprite pTiledSprite) { final float[] bufferData = this.mBufferData; final float width = pTiledSprite.getWidth(); // TODO Optimize with field access? final float height = pTiledSprite.getHeight(); // TODO Optimize with field access? final int tileCount = pTiledSprite.getTileCount(); int bufferDataOffset = 0; for (int i = 0; i < tileCount; i++) { bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0; bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0; bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0; bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height; bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width; bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0; bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width; bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = 0; bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = 0; bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height; bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = width; bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = height; bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE; } this.setDirtyOnHardware(); }
Example 6
Source File: HighPerformanceTiledSpriteVertexBufferObject.java From 30-android-libraries-in-30-days with Apache License 2.0 | 5 votes |
@Override public void onUpdateVertices(final TiledSprite pTiledSprite) { final float[] bufferData = this.mBufferData; final float x = 0; final float y = 0; final float x2 = pTiledSprite.getWidth(); // TODO Optimize with field access? final float y2 = pTiledSprite.getHeight(); // TODO Optimize with field access? final int tileCount = pTiledSprite.getTileCount(); int bufferDataOffset = 0; for(int i = 0; i < tileCount; i++) { bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x; bufferData[bufferDataOffset + 0 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y; bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x; bufferData[bufferDataOffset + 1 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2; bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2; bufferData[bufferDataOffset + 2 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y; bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2; bufferData[bufferDataOffset + 3 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y; bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x; bufferData[bufferDataOffset + 4 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2; bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_X] = x2; bufferData[bufferDataOffset + 5 * TiledSprite.VERTEX_SIZE + Sprite.VERTEX_INDEX_Y] = y2; bufferDataOffset += TiledSprite.TILEDSPRITE_SIZE; } this.setDirtyOnHardware(); }