Newer
Older
CactusClient / src / framework / RWT / RWTSprites.java
s-iwatani on 15 May 2018 935 bytes 途中
package framework.RWT;

import javax.microedition.khronos.opengles.GL10;
import java.util.ArrayList;

public class RWTSprites {
    private ArrayList<RWTSprite> sprites = new ArrayList<RWTSprite>();

    public RWTSprites() {}

    /**
     * スプライトの追加
     *
     * @author s,iwatani
     * @param sprite RWTSprite
     */
    public void addSprite(RWTSprite sprite) {
        sprites.add(sprite);
    }

    public void removeSprite(RWTSprite sprite) {
        sprites.remove(sprite);
    }

    public void draw(GL10 gl) {
        gl.glDisable(GL10.GL_DEPTH_TEST);
        gl.glDisable(GL10.GL_DITHER);
        gl.glEnable(GL10.GL_TEXTURE_2D);

        //テクスチャ0番をアクティブにする
        gl.glActiveTexture(GL10.GL_TEXTURE0);

        for (RWTSprite sprite : sprites){
            sprite.draw(gl);
        }

        gl.glEnable(GL10.GL_DEPTH_TEST);
        gl.glEnable(GL10.GL_DITHER);
    }
}