use of com.badlogic.gdx.graphics.g2d.TextureRegion in project commons-gdx by gemserk.
the class SpriteUtils method cut.
/**
* Modifies the Sprite region to the given TextureRegion by the SpriteRegion and its internal inner region relative values.
*
* @param sprite
* The Sprite to be modified.
* @param spriteRegion
* The SpriteRegion with the values to be used when cutting the Sprite.
*/
public static void cut(Sprite sprite, SpriteRegion spriteRegion) {
TextureRegion textureRegion = spriteRegion.textureRegion;
float u0 = spriteRegion.u0;
float v0 = spriteRegion.v0;
float u1 = spriteRegion.u1;
float v1 = spriteRegion.v1;
float width = spriteRegion.width;
float height = spriteRegion.height;
cut(sprite, textureRegion, u0, v0, u1, v1, width, height);
}
use of com.badlogic.gdx.graphics.g2d.TextureRegion in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnIsAliasWhenSameRegion.
@Test
public void shouldReturnIsAliasWhenSameRegion() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
Sprite sprite1 = new Sprite(region1);
Sprite sprite2 = new Sprite(region1);
assertTrue(SpriteUtils.isAliasSprite(sprite1, sprite2));
}
use of com.badlogic.gdx.graphics.g2d.TextureRegion in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnIsAliasWhenSameSprite.
@Test
public void shouldReturnIsAliasWhenSameSprite() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
Sprite sprite1 = new Sprite(region1);
assertTrue(SpriteUtils.isAliasSprite(sprite1, sprite1));
}
use of com.badlogic.gdx.graphics.g2d.TextureRegion in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnNotAliasWhenSpriteAndAtlasSprite.
@Test
public void shouldReturnNotAliasWhenSpriteAndAtlasSprite() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
Sprite sprite1 = new Sprite(region1);
Sprite sprite2 = new AtlasSprite(new AtlasRegion(texture512x512, 50, 30, 40, 40));
assertFalse(SpriteUtils.isAliasSprite(sprite1, sprite2));
}
use of com.badlogic.gdx.graphics.g2d.TextureRegion in project commons-gdx by gemserk.
the class SpriteUtilsTest method shouldReturnNotAliasWhenRegionAreNotEqual.
@Test
public void shouldReturnNotAliasWhenRegionAreNotEqual() {
TextureRegion region1 = new TextureRegion(texture512x512, 50, 30, 40f, 40f);
TextureRegion region2 = new TextureRegion(texture512x512, 50, 30, 10f, 40f);
Sprite sprite1 = new Sprite(region1);
Sprite sprite2 = new Sprite(region2);
assertFalse(SpriteUtils.isAliasSprite(sprite1, sprite2));
}
Aggregations