Java Code Examples for org.andengine.entity.primitive.Rectangle#getWidth()
The following examples show how to use
org.andengine.entity.primitive.Rectangle#getWidth() .
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: HighPerformanceRectangleVertexBufferObject.java From tilt-game-android with MIT License | 6 votes |
@Override public void onUpdateVertices(final Rectangle pRectangle) { final float[] bufferData = this.mBufferData; final float width = pRectangle.getWidth(); // TODO Optimize with field access? final float height = pRectangle.getHeight(); // TODO Optimize with field access? bufferData[(0 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_X] = 0; bufferData[(0 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_Y] = 0; bufferData[(1 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_X] = 0; bufferData[(1 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_Y] = height; bufferData[(2 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_X] = width; bufferData[(2 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_Y] = 0; bufferData[(3 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_X] = width; bufferData[(3 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_Y] = height; this.setDirtyOnHardware(); }
Example 2
Source File: LowMemoryRectangleVertexBufferObject.java From tilt-game-android with MIT License | 6 votes |
@Override public void onUpdateVertices(final Rectangle pRectangle) { final FloatBuffer bufferData = this.mFloatBuffer; final float width = pRectangle.getWidth(); // TODO Optimize with field access? final float height = pRectangle.getHeight(); // TODO Optimize with field access? bufferData.put((0 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_X, 0); bufferData.put((0 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_Y, 0); bufferData.put((1 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_X, 0); bufferData.put((1 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_Y, height); bufferData.put((2 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_X, width); bufferData.put((2 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_Y, 0); bufferData.put((3 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_X, width); bufferData.put((3 * Rectangle.VERTEX_SIZE) + Rectangle.VERTEX_INDEX_Y, height); this.setDirtyOnHardware(); }
Example 3
Source File: HighPerformanceRectangleVertexBufferObject.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
@Override public void onUpdateVertices(final Rectangle pRectangle) { final float[] bufferData = this.mBufferData; final float x = 0; final float y = 0; final float x2 = pRectangle.getWidth(); // TODO Optimize with field access? final float y2 = pRectangle.getHeight(); // TODO Optimize with field access? bufferData[0 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_X] = x; bufferData[0 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_Y] = y; bufferData[1 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_X] = x; bufferData[1 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_Y] = y2; bufferData[2 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_X] = x2; bufferData[2 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_Y] = y; bufferData[3 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_X] = x2; bufferData[3 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_Y] = y2; this.setDirtyOnHardware(); }
Example 4
Source File: LowMemoryRectangleVertexBufferObject.java From 30-android-libraries-in-30-days with Apache License 2.0 | 6 votes |
@Override public void onUpdateVertices(final Rectangle pRectangle) { final FloatBuffer bufferData = this.mFloatBuffer; final float x = 0; final float y = 0; final float x2 = pRectangle.getWidth(); final float y2 = pRectangle.getHeight(); bufferData.put(0 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_X, x); bufferData.put(0 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_Y, y); bufferData.put(1 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_X, x); bufferData.put(1 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_Y, y2); bufferData.put(2 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_X, x2); bufferData.put(2 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_Y, y); bufferData.put(3 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_X, x2); bufferData.put(3 * Rectangle.VERTEX_SIZE + Rectangle.VERTEX_INDEX_Y, y2); this.setDirtyOnHardware(); }