Newer
Older
JumpingGame / src / main / java / views / PlayerRenderer.java
package views;

import entities.*;
import models.IModel;
import models.JumpGameModel;

//---------------------------------------------------------------
//
public class PlayerRenderer implements IView {
    private Sprite sprite;

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    public PlayerRenderer(String path) {
        this.sprite = new Sprite(path);
        this.sprite.setScaleValue(1);
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    // JumpGameModelから座標を取得
    @Override
    public void update(IModel model){
        JumpGameModel jumpGameModel = (JumpGameModel) model;
        sprite.setPositionValue(jumpGameModel.getPosition().getValue());
    }


    //---------------------------------------------------------------
    // 描画する
    @Override
    public void display() {
        sprite.draw();
    }

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