Newer
Older
JumpingGame / src / main / java / views / TileRenderer.java
k-fujii on 16 Nov 2021 1 KB 地面を仮描画しました.
package views;

import entities.Pair;
import entities.Sprite;
import models.IModel;

//---------------------------------------------------------------
// タイルの描画
public class TileRenderer implements IView {
    private Sprite sprite;

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    public TileRenderer(String path, Pair<Double> initPosition) {
        this.sprite = new Sprite(path);
        this.sprite.setScaleValue(1);
        this.sprite.setPositionValue(initPosition);
    }

    //---------------------------------------------------------------
    public TileRenderer(String path, Pair<Double> initPosition, double scale) {
        this.sprite = new Sprite(path);
        this.sprite.setScaleValue(scale);
        this.sprite.setPositionValue(initPosition);
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    // getter
    public double getScaleValue() {
        return this.sprite.getScaleValue();
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    // setter
    public void setScaleValue(double scaleValue){
        this.sprite.setScaleValue(scaleValue);
    }


    //---------------------------------------------------------------
    //---------------------------------------------------------------
    //
    public void display(IModel model) {
        sprite.draw();
    }

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