Android Open Source - candymem Sprite Item






From Project

Back to project page candymem.

License

The source code is released under:

GNU General Public License

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;
/*  w ww. j  a v  a  2s.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.*;

public class SpriteItem extends BaseItem
{
    protected TextureRegion [] textures;
    protected int 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();
    }

    public int getIndex() { return index; }

    public void setIndex(int index)
    {
        this.index = index;
    }

    public void draw(SpriteBatch sb)
    {
        final float a = getAlpha();
        final float s = getScale();
        final float x = getX();
        final float y = getY();
        final float r = getRotation();
        final float w2 = w / 2;
        final float h2 = h / 2;
        final float hp = UIC.halfpixel;

        sb.setColor( cr, cg, cb, a);

        sb.draw(textures[index],
                x + hp, y + hp,
                w2, h2,
                w, h,
                s, s, r);
    }
}




Java Source Code List

com.badlogic.gdx.backends.lwjgl.LwjglApplication.java
se.tube42.kidsmem.KidsMemoryApp.java
se.tube42.kidsmem.SystemHandler.java
se.tube42.kidsmem.android.MainActivity.java
se.tube42.kidsmem.data.Assets.java
se.tube42.kidsmem.data.Constants.java
se.tube42.kidsmem.data.Settings.java
se.tube42.kidsmem.data.UI.java
se.tube42.kidsmem.data.World.java
se.tube42.kidsmem.desktop.DesktopMain.java
se.tube42.kidsmem.item.Button.java
se.tube42.kidsmem.item.FireworkItem.java
se.tube42.kidsmem.item.GameStat.java
se.tube42.kidsmem.item.TileSprite.java
se.tube42.kidsmem.item.TopBar.java
se.tube42.kidsmem.logic.AssetHelper.java
se.tube42.kidsmem.logic.GameHelper.java
se.tube42.kidsmem.logic.SettingsHelper.java
se.tube42.kidsmem.logic.SizeHelper.java
se.tube42.kidsmem.scene.BackgroundScene.java
se.tube42.kidsmem.scene.GameScene.java
se.tube42.kidsmem.scene.MenuScene.java
se.tube42.kidsmem.service.ServiceProvider.java
se.tube42.lib.item.BaseItem.java
se.tube42.lib.item.BaseText.java
se.tube42.lib.item.ParticleItem.java
se.tube42.lib.item.PatchItem.java
se.tube42.lib.item.SpriteItem.java
se.tube42.lib.scene.LayerList.java
se.tube42.lib.scene.Layer.java
se.tube42.lib.scene.SceneManager.java
se.tube42.lib.scene.Scene.java
se.tube42.lib.service.AssetService.java
se.tube42.lib.service.JobService.java
se.tube42.lib.service.RandomService.java
se.tube42.lib.service.StorageService.java
se.tube42.lib.util.BaseApp.java
se.tube42.lib.util.UIC.java