List of usage examples for com.badlogic.gdx.graphics.g2d TextureRegion isFlipY
public boolean isFlipY()
From source file:cmnworks.com.angrybee.Obstacles.java
License:Open Source License
public void draw(AngryBee parent) { TextureRegion targetRegion = new TextureRegion(); boolean hadIntersection = false; for (Obstacle island : this.islands) { if (!parent.Game.isOver()) { this.positionPolygon(island.position.x, island.position.y); }// w w w . ja v a 2 s . c o m if (hadIntersection = this.isIntersectionOccur(parent, this.polygon, parent.Actor.polygon)) targetRegion = island.image; if (parent.Game.isOver()) { /* intersection effect */ if (!this.intersectionEffect) { if (hadIntersection) parent.Sound.intersection.play(); parent.Music.running.stop(); parent.Music.gameOver.play(); if (!parent.Actor.isScreenOut(parent) && hadIntersection) { island.image = new TextureRegion(targetRegion); island.image.setRegion(new Texture(this.setTextureIntersection)); if (targetRegion.isFlipY()) island.image.flip(false, true); } this.intersectionEffect = true; } ++this.getGameOverMSHold; } float x = parent.Game.isRunning() ? island.position.x -= 3 : island.position.x; parent.batch.draw(island.image, x, island.position.y); } }
From source file:com.codamasters.LNHelpers.AnimatedSprite.java
License:Apache License
/** flips all frames from {@code startTime} to {@code endTime} * @param startTime the animation state time of the first frame to flip * @param endTime the animation state time of the last frame to flip * @param set if the frames should be set to {@code flipX} and {@code flipY} instead of actually flipping them */ public void flipFrames(float startTime, float endTime, boolean flipX, boolean flipY, boolean set) { for (float t = startTime; t < endTime; t += animation.getFrameDuration()) { TextureRegion frame = animation.getKeyFrame(t); frame.flip(flipX && (set ? !frame.isFlipX() : true), flipY && (set ? !frame.isFlipY() : true)); }/*from ww w. java 2s . com*/ }
From source file:com.github.fauu.helix.graphics.AnimatedDecal.java
License:Apache License
@Override public void flipFrames(float startTime, float endTime, boolean flipX, boolean flipY, boolean set) { Animation animation = getAnimated(); for (float t = startTime; t < endTime; t += animation.getFrameDuration()) { TextureRegion frame = animation.getKeyFrame(t); frame.flip(flipX && (!set || !frame.isFlipX()), flipY && (!set || !frame.isFlipY())); }// w w w . j a v a 2 s . c o m }
From source file:com.me.cyberPunkJam.AnimatedSprite.java
License:Apache License
/** flips all frames from {@code startTime} to {@code endTime} * @param startTime the animation state time of the first frame to flip * @param endTime the animation state time of the last frame to flip * @param set if the frames should be set to {@code flipX} and {@code flipY} instead of actually flipping them */ public void flipFrames(float startTime, float endTime, boolean flipX, boolean flipY, boolean set) { for (float t = startTime; t < endTime; t += animation.frameDuration) { TextureRegion frame = animation.getKeyFrame(t); frame.flip(flipX && (set ? !frame.isFlipX() : true), flipY && (set ? !frame.isFlipY() : true)); }/* www .ja v a 2s . co m*/ }
From source file:com.stercore.code.net.dermetfan.utils.libgdx.graphics.AnimatedSprite.java
License:Apache License
/** flips all frames from {@code startTime} to {@code endTime} * @param startTime the animation state time of the first frame to flip * @param endTime the animation state time of the last frame to flip * @param set if the frames should be set to {@code flipX} and {@code flipY} instead of actually flipping them */ public void flipFrames(float startTime, float endTime, boolean flipX, boolean flipY, boolean set) { for (float t = startTime; t < endTime; t += animation.getFrameDuration()) { TextureRegion frame = animation.getKeyFrame(t); frame.flip(set ? flipX && !frame.isFlipX() : flipX, set ? flipY && !frame.isFlipY() : flipY); }//from w ww . j a va2s .c o m }
From source file:entityy.AnimatedSprite.java
License:Apache License
/** flips all frames from {@code startTime} to {@code endTime} * @param startTime the animation state time of the first frame to flip * @param endTime the animation state time of the last frame to flip * @param set if the frames should be set to {@code flipX} and {@code flipY} instead of actually flipping them */ public void flipFrames(float startTime, float endTime, boolean flipX, boolean flipY, boolean set) { for (float t = startTime; t < endTime; t += animation.getFrameDuration()) { TextureRegion frame = (TextureRegion) animation.getKeyFrame(t); frame.flip(flipX && (set ? !frame.isFlipX() : true), flipY && (set ? !frame.isFlipY() : true)); }// www. j a v a 2 s. c o m }
From source file:es.eucm.ead.engine.systems.effects.transitions.Slice.java
License:Open Source License
@Override public void render(Batch batch, TextureRegion currScreen, Region currScreenRegion, TextureRegion nextScreen, Region nextScreenRegion, float completion) { batch.draw(currScreen, currScreenRegion.x, currScreenRegion.y, currScreenRegion.w, currScreenRegion.h); float w = nextScreenRegion.w; float h = nextScreenRegion.h; float x = nextScreenRegion.x; float y = nextScreenRegion.y; int numSlices = sliceIndex.size; Texture nextTex = nextScreen.getTexture(); completion = easing.apply(completion); if (horizontal) { int sliceTexelHeight = nextTex.getHeight() / numSlices; float sliceHeight = h * ((float) sliceTexelHeight / nextTex.getHeight()); float yOverflow = h - numSlices * sliceHeight; for (int i = 0; i < numSlices; ++i) { // current slice/column int offsetIdx; float offsetY; boolean flipY; if (nextScreen.isFlipY()) { flipY = true;/* w ww.jav a2 s . co m*/ offsetIdx = i; offsetY = 0; } else { flipY = false; offsetIdx = numSlices - i - 1; offsetY = yOverflow; } y = offsetIdx * sliceHeight + nextScreenRegion.y + offsetY; // horizontal displacement using randomized // list of slice indices float offsetX = w * (1 + sliceIndex.get(i) / (float) numSlices); switch (direction) { case UP: x = nextScreenRegion.x - offsetX + offsetX * completion; break; case DOWN: x = nextScreenRegion.x + offsetX - offsetX * completion; break; case UP_DOWN: if (i % 2 == 0) { x = nextScreenRegion.x - offsetX + offsetX * completion; } else { x = nextScreenRegion.x + offsetX - offsetX * completion; } break; } batch.draw(nextTex, x, y, 0, 0, w, sliceHeight, 1, 1, 0, 0, i * sliceTexelHeight, nextTex.getWidth(), sliceTexelHeight, false, flipY); } } else { int sliceTexelWidth = nextTex.getWidth() / numSlices; float sliceWidth = w * ((float) sliceTexelWidth / nextTex.getWidth()); for (int i = 0; i < numSlices; ++i) { // current slice/column x = i * sliceWidth + nextScreenRegion.x; // vertical displacement using randomized // list of slice indices float offsetY = h * (1 + sliceIndex.get(i) / (float) numSlices); switch (direction) { case UP: y = nextScreenRegion.y - offsetY + offsetY * completion; break; case DOWN: y = nextScreenRegion.y + offsetY - offsetY * completion; break; case UP_DOWN: if (i % 2 == 0) { y = nextScreenRegion.y - offsetY + offsetY * completion; } else { y = nextScreenRegion.y + offsetY - offsetY * completion; } break; } batch.draw(nextTex, x, y, 0, 0, sliceWidth, h, 1, 1, 0, i * sliceTexelWidth, 0, sliceTexelWidth, nextTex.getHeight(), false, nextScreen.isFlipY() ? true : false); } } }
From source file:net.dermetfan.utils.libgdx.graphics.ManagedAnimation.java
License:Apache License
/** flips all frames from {@code startTime} to {@code endTime} * @param startTime the animation state time of the first frame to flip * @param endTime the animation state time of the last frame to flip * @param set if the frames should be set to {@code flipX} and {@code flipY} instead of actually flipping them */ default void flipFrames(float startTime, float endTime, boolean flipX, boolean flipY, boolean set) { Animation animation = getAnimated(); for (float t = startTime; t < endTime; t += animation.getFrameDuration()) { TextureRegion frame = animation.getKeyFrame(t); frame.flip(flipX && (set ? !frame.isFlipX() : true), flipY && (set ? !frame.isFlipY() : true)); }/*w w w. j av a2 s . co m*/ }