use of com.badlogic.gdx.graphics.g2d.TextureRegion in project libgdx by libgdx.
the class NinePatchTest method newULQuadPatch.
// Make a upper-left "quad" patch (only 4 patches defined in the top-left corner of the ninepatch)
static NinePatch newULQuadPatch() {
final int patchSize = 8;
final int pixmapSize = patchSize * 2;
TextureRegion tr = newPatchPix(patchSize, pixmapSize);
return new NinePatch(tr, patchSize, 0, patchSize, 0);
}
use of com.badlogic.gdx.graphics.g2d.TextureRegion in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnIsAliasWhenRegionEquals.
@Test
public void shouldReturnIsAliasWhenRegionEquals() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
TextureRegion region2 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
Sprite sprite1 = new Sprite(region1);
Sprite sprite2 = new Sprite(region2);
assertTrue(SpriteUtils.isAliasSprite(sprite1, sprite2));
}
use of com.badlogic.gdx.graphics.g2d.TextureRegion in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnFalseIfSpriteNull.
@Test
public void shouldReturnFalseIfSpriteNull() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
Sprite sprite1 = new Sprite(region1);
assertFalse(SpriteUtils.isAliasSprite(sprite1, null));
assertFalse(SpriteUtils.isAliasSprite(null, sprite1));
}
use of com.badlogic.gdx.graphics.g2d.TextureRegion in project commons-gdx by gemserk.
the class TextureRegionUtilsTest method testRegionEquals.
@Test
public void testRegionEquals() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
TextureRegion region2 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
TextureRegion region3 = new TextureRegion(texture512x512, 60, 30, 40f, 40f);
TextureRegion region4 = new TextureRegion(texture512x512, 50, 40, 40f, 40f);
TextureRegion region5 = new TextureRegion(texture512x512, 50, 30, 50f, 40f);
TextureRegion region6 = new TextureRegion(texture512x512, 50, 30, 40f, 20f);
assertTrue(TextureRegionUtils.textureRegionEquals(region1, region1));
assertTrue(TextureRegionUtils.textureRegionEquals(region1, region2));
assertFalse(TextureRegionUtils.textureRegionEquals(region1, region3));
assertFalse(TextureRegionUtils.textureRegionEquals(region1, region4));
assertFalse(TextureRegionUtils.textureRegionEquals(region1, region5));
assertFalse(TextureRegionUtils.textureRegionEquals(region1, region6));
}
use of com.badlogic.gdx.graphics.g2d.TextureRegion in project Entitas-Java by Rubentxu.
the class AnimationSystem method execute.
@Override
public void execute(float deltaTime) {
for (GameEntity e : _groupAnimation.getEntities()) {
Animations animations = e.getAnimations();
TextureView view = e.getTextureView();
animations.time += deltaTime;
Animation<TextureRegion> animation = animations.currentAnimation;
if (animation != null) {
view.texture = animation.getKeyFrame(animations.time);
}
}
}
Aggregations