Newer
Older
JumpingGame / src / main / java / entities / Sprite.java
package entities;

import views.IView;

//---------------------------------------------------------------
//
public class Sprite {

    private Pair<Double> positionValue;
    private Texture texture;
    private Image2D img;

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    //
    public Sprite(String path) {
        this.positionValue = new Pair<>(0d, 0d);
        texture = new Texture("player", path);
        img = new Image2D(texture);
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    // setter
    public void setPositionValue(Pair<Double> positionValue) {
        this.positionValue = positionValue;
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    //
    public void draw() {
        img.setPosition(positionValue);
        img.draw();
    }

    //---------------------------------------------------------------
    // テクスチャの開放
    public void delete() {
        texture.delete();
    }

    //---------------------------------------------------------------

}