org.andengine.opengl.texture.region.ITextureRegion Java Examples

The following examples show how to use org.andengine.opengl.texture.region.ITextureRegion. 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: SpriteBatch.java    From tilt-game-android with MIT License 6 votes vote down vote up
/**
 * @param pTextureRegion
 * @param pWidth
 * @param pHeight
 * @param pTransformation
 * @param pRed
 * @param pGreen
 * @param pBlue
 * @param pAlpha
 */
protected void add(final ITextureRegion pTextureRegion, final float pWidth, final float pHeight, final Transformation pTransformation, final float pRed, final float pGreen, final float pBlue, final float pAlpha) {
	SpriteBatch.VERTICES_TMP[0] = 0;
	SpriteBatch.VERTICES_TMP[1] = 0;

	SpriteBatch.VERTICES_TMP[2] = 0;
	SpriteBatch.VERTICES_TMP[3] = pHeight;

	SpriteBatch.VERTICES_TMP[4] = pWidth;
	SpriteBatch.VERTICES_TMP[5] = 0;

	SpriteBatch.VERTICES_TMP[6] = pWidth;
	SpriteBatch.VERTICES_TMP[7] = pHeight;

	pTransformation.transform(SpriteBatch.VERTICES_TMP);

	this.addInner(pTextureRegion, SpriteBatch.VERTICES_TMP[0], SpriteBatch.VERTICES_TMP[1], SpriteBatch.VERTICES_TMP[2], SpriteBatch.VERTICES_TMP[3], SpriteBatch.VERTICES_TMP[4], SpriteBatch.VERTICES_TMP[5], SpriteBatch.VERTICES_TMP[6], SpriteBatch.VERTICES_TMP[7], pRed, pGreen, pBlue, pAlpha);
}
 
Example #2
Source File: SpriteBatch.java    From tilt-game-android with MIT License 6 votes vote down vote up
/**
 * @see {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float)} {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, Transformation, float, float, float, float)}.
 */
public void draw(final ITextureRegion pTextureRegion, final IEntity pEntity, final float pColorABGRPackedInt) {
	if (pEntity.isVisible()) {
		this.assertCapacity();

		this.assertTexture(pTextureRegion);

		if (pEntity.isRotatedOrScaledOrSkewed()) {
			this.addWithPackedColor(pTextureRegion, pEntity.getWidth(), pEntity.getHeight(), pEntity.getLocalToParentTransformation(), pColorABGRPackedInt);
		} else {
			this.addWithPackedColor(pTextureRegion, pEntity.getX(), pEntity.getY(), pEntity.getWidth(), pEntity.getHeight(), pColorABGRPackedInt);
		}

		this.mIndex++;
	}
}
 
Example #3
Source File: SpriteBatch.java    From tilt-game-android with MIT License 6 votes vote down vote up
/**
 * @param pTextureRegion
 * @param pWidth
 * @param pHeight
 * @param pTransformation
 * @param pColorABGRPackedInt
 */
protected void addWithPackedColor(final ITextureRegion pTextureRegion, final float pWidth, final float pHeight, final Transformation pTransformation, final float pColorABGRPackedInt) {
	SpriteBatch.VERTICES_TMP[0] = 0;
	SpriteBatch.VERTICES_TMP[1] = 0;

	SpriteBatch.VERTICES_TMP[2] = 0;
	SpriteBatch.VERTICES_TMP[3] = pHeight;

	SpriteBatch.VERTICES_TMP[4] = pWidth;
	SpriteBatch.VERTICES_TMP[5] = 0;

	SpriteBatch.VERTICES_TMP[6] = pWidth;
	SpriteBatch.VERTICES_TMP[7] = pHeight;

	pTransformation.transform(SpriteBatch.VERTICES_TMP);

	this.mSpriteBatchVertexBufferObject.addWithPackedColor(pTextureRegion, SpriteBatch.VERTICES_TMP[0], SpriteBatch.VERTICES_TMP[1], SpriteBatch.VERTICES_TMP[2], SpriteBatch.VERTICES_TMP[3], SpriteBatch.VERTICES_TMP[4], SpriteBatch.VERTICES_TMP[5], SpriteBatch.VERTICES_TMP[6], SpriteBatch.VERTICES_TMP[7], pColorABGRPackedInt);
}
 
Example #4
Source File: SpriteBatch.java    From tilt-game-android with MIT License 5 votes vote down vote up
/**
 * @see {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float)}.
 */
public void draw(final ITextureRegion pTextureRegion, final float pX, final float pY, final float pWidth, final float pHeight, final float pColorABGRPackedInt) {
	this.assertCapacity();
	this.assertTexture(pTextureRegion);

	this.add(pTextureRegion, pX, pY, pWidth, pHeight, pColorABGRPackedInt);

	this.mIndex++;
}
 
Example #5
Source File: SpriteBatch.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
/**
 * @see {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float, float, float)}.
 */
public void draw(final ITextureRegion pTextureRegion, final float pX, final float pY, final float pWidth, final float pHeight, final float pRed, final float pGreen, final float pBlue, final float pAlpha) {
	this.assertCapacity();
	this.assertTexture(pTextureRegion);

	this.add(pTextureRegion, pX, pY, pWidth, pHeight, pRed, pGreen, pBlue, pAlpha);

	this.mIndex++;
}
 
Example #6
Source File: SpriteBatch.java    From tilt-game-android with MIT License 5 votes vote down vote up
/**
 * @param pTextureRegion
 * @param pX
 * @param pY
 * @param pWidth
 * @param pHeight
 * @param pRotation around the center (pWidth * 0.5f, pHeight * 0.5f)
 * @param pColorABGRPackedInt
 */
protected void addWithPackedColor(final ITextureRegion pTextureRegion, final float pX, final float pY, final float pWidth, final float pHeight, final float pRotation, final float pColorABGRPackedInt) {
	final float widthHalf = pWidth * 0.5f;
	final float heightHalf = pHeight * 0.5f;

	SpriteBatch.TRANSFORATION_TMP.setToIdentity();

	SpriteBatch.TRANSFORATION_TMP.postTranslate(-widthHalf, -heightHalf);
	SpriteBatch.TRANSFORATION_TMP.postRotate(pRotation);
	SpriteBatch.TRANSFORATION_TMP.postTranslate(widthHalf, heightHalf);
	SpriteBatch.TRANSFORATION_TMP.postTranslate(pX, pY);

	this.addWithPackedColor(pTextureRegion, pWidth, pHeight, SpriteBatch.TRANSFORATION_TMP, pColorABGRPackedInt);
}
 
Example #7
Source File: SpriteBatch.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
/**
 * @param pTextureRegion
 * @param pX
 * @param pY
 * @param pWidth
 * @param pHeight
 * @param pRotation around the center (pWidth * 0.5f, pHeight * 0.5f)
 * @param pColorABGRPackedInt
 */
protected void addWithPackedColor(final ITextureRegion pTextureRegion, final float pX, final float pY, final float pWidth, final float pHeight, final float pRotation, final float pColorABGRPackedInt) {
	final float widthHalf = pWidth * 0.5f;
	final float heightHalf = pHeight * 0.5f;

	SpriteBatch.TRANSFORATION_TMP.setToIdentity();

	SpriteBatch.TRANSFORATION_TMP.postTranslate(-widthHalf, -heightHalf);
	SpriteBatch.TRANSFORATION_TMP.postRotate(pRotation);
	SpriteBatch.TRANSFORATION_TMP.postTranslate(widthHalf, heightHalf);
	SpriteBatch.TRANSFORATION_TMP.postTranslate(pX, pY);

	this.addWithPackedColor(pTextureRegion, pWidth, pHeight, SpriteBatch.TRANSFORATION_TMP, pColorABGRPackedInt);
}
 
Example #8
Source File: GameFieldView.java    From sopa with Apache License 2.0 5 votes vote down vote up
GameFieldView(float pX, float pY, float spacePerTile, GameService gameService,
    Map<Character, TextureRegion> regionMap, VertexBufferObjectManager vbom, ITextureRegion tilesBorderRegion) {

    super(pX, pY);
    this.gameService = gameService;
    this.spacePerTile = spacePerTile;
    this.tileRegionMap = regionMap;
    this.vbom = vbom;
    this.tilesBorderRegion = tilesBorderRegion;
}
 
Example #9
Source File: SpriteBatch.java    From tilt-game-android with MIT License 5 votes vote down vote up
/**
 * @see {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float, float, float)}.
 */
public void draw(final ITextureRegion pTextureRegion, final float pX, final float pY, final float pWidth, final float pHeight, final float pRed, final float pGreen, final float pBlue, final float pAlpha) {
	this.assertCapacity();
	this.assertTexture(pTextureRegion);

	this.add(pTextureRegion, pX, pY, pWidth, pHeight, pRed, pGreen, pBlue, pAlpha);

	this.mIndex++;
}
 
Example #10
Source File: TileSprite.java    From sopa with Apache License 2.0 5 votes vote down vote up
TileSprite(final float pX, final float pY, final float pWidth, final float pHeight,
    List<ITextureRegion> pTextureRegions, final VertexBufferObjectManager vbo) {

    super(pX, pY, pWidth, pHeight, pTextureRegions.get(0), vbo);
    uuid = UUID.randomUUID();
    this.index = 0;
    this.pTextureRegions = pTextureRegions;
}
 
Example #11
Source File: ButtonSprite.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
private void changeState(final State pState) {
	if(pState == this.mState) {
		return;
	}

	this.mState = pState;

	final int stateTiledTextureRegionIndex = this.mState.getTiledTextureRegionIndex();
	if(stateTiledTextureRegionIndex >= this.mStateCount) {
		this.setCurrentTileIndex(0);
		Debug.w(this.getClass().getSimpleName() + " changed its " + State.class.getSimpleName() + " to " + pState.toString() + ", which doesn't have a " + ITextureRegion.class.getSimpleName() + " supplied. Applying default " + ITextureRegion.class.getSimpleName() + ".");
	} else {
		this.setCurrentTileIndex(stateTiledTextureRegionIndex);
	}
}
 
Example #12
Source File: SpriteBatch.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public void drawWithoutChecks(final ITextureRegion pTextureRegion, final IEntity pEntity, final float pWidth, final float pHeight, final float pRed, final float pGreen, final float pBlue, final float pAlpha) {
	if(pEntity.isVisible()) {
		if(pEntity.isRotatedOrScaledOrSkewed()) {
			this.add(pTextureRegion, pWidth, pHeight, pEntity.getLocalToParentTransformation(), pRed, pGreen, pBlue, pAlpha);
		} else {
			this.add(pTextureRegion, pEntity.getX(), pEntity.getY(), pWidth, pHeight, pRed, pGreen, pBlue, pAlpha);
		}

		this.mIndex++;
	}
}
 
Example #13
Source File: SpriteBatch.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
public void drawWithoutChecks(final ITextureRegion pTextureRegion, final IEntity pEntity, final float pWidth, final float pHeight, final float pColorABGRPackedInt) {
	if(pEntity.isVisible()) {
		if(pEntity.isRotatedOrScaledOrSkewed()) {
			this.addWithPackedColor(pTextureRegion, pWidth, pHeight, pEntity.getLocalToParentTransformation(), pColorABGRPackedInt);
		} else {
			this.addWithPackedColor(pTextureRegion, pEntity.getX(), pEntity.getY(), pWidth, pHeight, pColorABGRPackedInt);
		}

		this.mIndex++;
	}
}
 
Example #14
Source File: SpriteBatch.java    From tilt-game-android with MIT License 5 votes vote down vote up
public void drawWithoutChecks(final ITextureRegion pTextureRegion, final IEntity pEntity, final float pColorABGRPackedInt) {
	if (pEntity.isVisible()) {
		if (pEntity.isRotatedOrScaledOrSkewed()) {
			this.addWithPackedColor(pTextureRegion, pEntity.getWidth(), pEntity.getHeight(), pEntity.getLocalToParentTransformation(), pColorABGRPackedInt);
		} else {
			this.addWithPackedColor(pTextureRegion, pEntity.getX(), pEntity.getY(), pEntity.getWidth(), pEntity.getHeight(), pColorABGRPackedInt);
		}

		this.mIndex++;
	}
}
 
Example #15
Source File: SpriteBatch.java    From tilt-game-android with MIT License 5 votes vote down vote up
/**
 * @param pTextureRegion
 * @param pX
 * @param pY
 * @param pWidth
 * @param pHeight
 * @param pRotation around the center (pWidth * 0.5f, pHeight * 0.5f)
 * @param pRed
 * @param pGreen
 * @param pBlue
 * @param pAlpha
 */
protected void add(final ITextureRegion pTextureRegion, final float pX, final float pY, final float pWidth, final float pHeight, final float pRotation, final float pRed, final float pGreen, final float pBlue, final float pAlpha) {
	final float widthHalf = pWidth * 0.5f;
	final float heightHalf = pHeight * 0.5f;

	SpriteBatch.TRANSFORATION_TMP.setToIdentity();

	SpriteBatch.TRANSFORATION_TMP.postTranslate(-widthHalf, -heightHalf);
	SpriteBatch.TRANSFORATION_TMP.postRotate(pRotation);
	SpriteBatch.TRANSFORATION_TMP.postTranslate(widthHalf, heightHalf);
	SpriteBatch.TRANSFORATION_TMP.postTranslate(pX, pY);

	this.add(pTextureRegion, pWidth, pHeight, SpriteBatch.TRANSFORATION_TMP, pRed, pGreen, pBlue, pAlpha);
}
 
Example #16
Source File: SpriteBatch.java    From tilt-game-android with MIT License 5 votes vote down vote up
/**
 * @see {@link SpriteBatchVertexBufferObject#add(ITextureRegion, float, float, float, float, float, float, float, float, float, float)}.
 */
public void draw(final ITextureRegion pTextureRegion, final float pX, final float pY, final float pWidth, final float pHeight, final float pRotation, final float pScaleX, final float pScaleY, final float pRed, final float pGreen, final float pBlue, final float pAlpha) {
	this.assertCapacity();
	this.assertTexture(pTextureRegion);

	this.add(pTextureRegion, pX, pY, pWidth, pHeight, pRotation, pScaleX, pScaleY, pRed, pGreen, pBlue, pAlpha);

	this.mIndex++;
}
 
Example #17
Source File: Sprite.java    From tilt-game-android with MIT License 5 votes vote down vote up
public Sprite(final float pX, final float pY, final float pWidth, final float pHeight, final ITextureRegion pTextureRegion, final ISpriteVertexBufferObject pSpriteVertexBufferObject, final ShaderProgram pShaderProgram) {
	super(pX, pY, pShaderProgram);

	this.mTextureRegion = pTextureRegion;
	this.mSpriteVertexBufferObject = pSpriteVertexBufferObject;

	this.setBlendingEnabled(true);
	this.initBlendFunction(pTextureRegion);

	this.setSize(pWidth, pHeight);

	this.onUpdateColor();
	this.onUpdateTextureCoordinates();
}
 
Example #18
Source File: SpriteBatch.java    From 30-android-libraries-in-30-days with Apache License 2.0 5 votes vote down vote up
/**
 * @see {@link SpriteBatchVertexBufferObject#addInner(ITextureRegion, float, float, float, float, float, float, float, float, float, float, float)}.
 */
public void draw(final ITextureRegion pTextureRegion, final float pX1, final float pY1, final float pX2, final float pY2, final float pX3, final float pY3, final float pX4, final float pY4, final float pRed, final float pGreen, final float pBlue, final float pAlpha) {
	this.assertCapacity();
	this.assertTexture(pTextureRegion);

	this.addInner(pTextureRegion, pX1, pY1, pX2, pY2, pX3, pY3, pX4, pY4, pRed, pGreen, pBlue, pAlpha);

	this.mIndex++;
}
 
Example #19
Source File: WorldController.java    From tilt-game-android with MIT License 5 votes vote down vote up
private void createBackground(final Bitmap background, @Nullable final String backgroundUrl) {
    if (background == null) return;

    BitmapTextureAtlas bitmapTextureAtlas = new BitmapTextureAtlas(_engine.getTextureManager(), _width, _height, TextureOptions.BILINEAR);
    IBitmapTextureAtlasSource baseTextureSource = new EmptyBitmapTextureAtlasSource(_width, _height);

    final IBitmapTextureAtlasSource bitmapTextureAtlasSource = new BaseBitmapTextureAtlasSourceDecorator(baseTextureSource) {
        @Override
        protected void onDecorateBitmap(Canvas pCanvas) throws Exception {
            if (backgroundUrl != null) {
                Bitmap template = BitmapFactory.decodeStream(GoogleFlipGameApplication.sContext.getAssets().open(backgroundUrl));
                pCanvas.drawBitmap(template, 0, 0, mPaint);
            }

            pCanvas.drawColor(_backgroundColor);
            pCanvas.drawBitmap(background, 0, 0, mPaint);
        }

        @Override
        public BaseBitmapTextureAtlasSourceDecorator deepCopy() {
            throw new IModifier.DeepCopyNotSupportedException();
        }
    };

    ITextureRegion mDecoratedBalloonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromSource(bitmapTextureAtlas, bitmapTextureAtlasSource,
            0, 0);
    bitmapTextureAtlas.load();

    Sprite sprite = new Sprite(0, 0, mDecoratedBalloonTextureRegion, _engine.getVertexBufferObjectManager());
    sprite.setOffsetCenter(0, 0);
    sprite.setWidth(_width);
    sprite.setHeight(_height);
    _background = new SpriteBackground(sprite);
    _engine.getScene().setBackground(_background);
}
 
Example #20
Source File: SpriteMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public SpriteMenuItem(final int pID, final float pWidth, final float pHeight, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
	super(0, 0, pWidth, pHeight, pTextureRegion, pVertexBufferObjectManager, pDrawType);

	this.mID = pID;
}
 
Example #21
Source File: SpriteBatch.java    From tilt-game-android with MIT License 4 votes vote down vote up
public void drawWithoutChecks(final ITextureRegion pTextureRegion, final float pX, final float pY, final float pWidth, final float pHeight, final float pRed, final float pGreen, final float pBlue, final float pAlpha) {
	this.add(pTextureRegion, pX, pY, pWidth, pHeight, pRed, pGreen, pBlue, pAlpha);

	this.mIndex++;
}
 
Example #22
Source File: UniformColorSprite.java    From tilt-game-android with MIT License 4 votes vote down vote up
public UniformColorSprite(final float pX, final float pY, final ITextureRegion pTextureRegion, final IUniformColorSpriteVertexBufferObject pVertexBufferObject, final ShaderProgram pShaderProgram) {
	this(pX, pY, pTextureRegion.getWidth(), pTextureRegion.getHeight(), pTextureRegion, pVertexBufferObject, pShaderProgram);
}
 
Example #23
Source File: DiamondSprite.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public DiamondSprite(final float pX, final float pY, final float pWidth, final float pHeight, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
	this(pX, pY, pWidth, pHeight, pTextureRegion, pVertexBufferObjectManager, DrawType.STATIC);
}
 
Example #24
Source File: UniformColorSprite.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public UniformColorSprite(final float pX, final float pY, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
	this(pX, pY, pTextureRegion.getWidth(), pTextureRegion.getHeight(), pTextureRegion, pVertexBufferObjectManager, DrawType.STATIC);
}
 
Example #25
Source File: Sprite.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public Sprite(final float pX, final float pY, final float pWidth, final float pHeight, final ITextureRegion pTextureRegion, final ISpriteVertexBufferObject pSpriteVertexBufferObject) {
	this(pX, pY, pWidth, pHeight, pTextureRegion, pSpriteVertexBufferObject, PositionColorTextureCoordinatesShaderProgram.getInstance());
}
 
Example #26
Source File: SpriteMenuItem.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public SpriteMenuItem(final int pID, final float pWidth, final float pHeight, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType, final ShaderProgram pShaderProgram) {
	super(0, 0, pWidth, pHeight, pTextureRegion, pVertexBufferObjectManager, pDrawType, pShaderProgram);

	this.mID = pID;
}
 
Example #27
Source File: DiamondSprite.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public DiamondSprite(final float pX, final float pY, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
	this(pX, pY, pTextureRegion.getWidth(), pTextureRegion.getHeight(), pTextureRegion, pVertexBufferObjectManager, pDrawType);
}
 
Example #28
Source File: UniformColorSprite.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public UniformColorSprite(final float pX, final float pY, final float pWidth, final float pHeight, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager, final DrawType pDrawType) {
	this(pX, pY, pWidth, pHeight, pTextureRegion, pVertexBufferObjectManager, pDrawType, PositionTextureCoordinatesUniformColorShaderProgram.getInstance());
}
 
Example #29
Source File: HighPerformanceUniformColorSpriteVertexBufferObject.java    From tilt-game-android with MIT License 4 votes vote down vote up
@Override
public void onUpdateTextureCoordinates(final Sprite pSprite) {
	final float[] bufferData = this.mBufferData;

	final ITextureRegion textureRegion = pSprite.getTextureRegion(); // TODO Optimize with field access?

	final float u;
	final float v;
	final float u2;
	final float v2;

	if (pSprite.isFlippedVertical()) { // TODO Optimize with field access?
		if (pSprite.isFlippedHorizontal()) { // TODO Optimize with field access?
			u = textureRegion.getU2();
			u2 = textureRegion.getU();
			v = textureRegion.getV2();
			v2 = textureRegion.getV();
		} else {
			u = textureRegion.getU();
			u2 = textureRegion.getU2();
			v = textureRegion.getV2();
			v2 = textureRegion.getV();
		}
	} else {
		if (pSprite.isFlippedHorizontal()) { // TODO Optimize with field access?
			u = textureRegion.getU2();
			u2 = textureRegion.getU();
			v = textureRegion.getV();
			v2 = textureRegion.getV2();
		} else {
			u = textureRegion.getU();
			u2 = textureRegion.getU2();
			v = textureRegion.getV();
			v2 = textureRegion.getV2();
		}
	}

	if (textureRegion.isRotated()) {
		bufferData[0 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_U] = u;
		bufferData[0 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_V] = v;

		bufferData[1 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_U] = u2;
		bufferData[1 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_V] = v;

		bufferData[2 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_U] = u;
		bufferData[2 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_V] = v2;

		bufferData[3 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_U] = u2;
		bufferData[3 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_V] = v2;
	} else {
		bufferData[0 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_U] = u;
		bufferData[0 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_V] = v2;

		bufferData[1 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_U] = u;
		bufferData[1 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_V] = v;

		bufferData[2 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_U] = u2;
		bufferData[2 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_V] = v2;

		bufferData[3 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_U] = u2;
		bufferData[3 * UniformColorSprite.VERTEX_SIZE + UniformColorSprite.TEXTURECOORDINATES_INDEX_V] = v;
	}

	this.setDirtyOnHardware();
}
 
Example #30
Source File: UncoloredSprite.java    From 30-android-libraries-in-30-days with Apache License 2.0 4 votes vote down vote up
public UncoloredSprite(final float pX, final float pY, final ITextureRegion pTextureRegion, final IUncoloredSpriteVertexBufferObject pUncoloredSpriteVertexBufferObject, final ShaderProgram pShaderProgram) {
	this(pX, pY, pTextureRegion.getWidth(), pTextureRegion.getHeight(), pTextureRegion, pUncoloredSpriteVertexBufferObject, pShaderProgram);
}