If you think the Android project candymem listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package se.tube42.lib.item;
/*www.java2s.com*/import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.*;
import se.tube42.lib.tweeny.*;
import se.tube42.lib.scene.*;
import se.tube42.lib.util.*;
publicclass SpriteItem extends BaseItem
{
protected TextureRegion [] textures;
protectedint index;
public SpriteItem(TextureRegion [] textures)
{
this(textures, 0);
}
public SpriteItem(TextureRegion [] textures, int index)
{
this.textures = textures;
this.index = index;
w = textures[index].getRegionWidth();
h = textures[index].getRegionHeight();
}
publicint getIndex() { return index; }
publicvoid setIndex(int index)
{
this.index = index;
}
publicvoid draw(SpriteBatch sb)
{
finalfloat a = getAlpha();
finalfloat s = getScale();
finalfloat x = getX();
finalfloat y = getY();
finalfloat r = getRotation();
finalfloat w2 = w / 2;
finalfloat h2 = h / 2;
finalfloat hp = UIC.halfpixel;
sb.setColor( cr, cg, cb, a);
sb.draw(textures[index],
x + hp, y + hp,
w2, h2,
w, h,
s, s, r);
}
}