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

import entities.*;
import models.IModel;
import models.PlayerModel;

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

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

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    // PlayerModelから座標を取得して描画する
    public void display(IModel model) {
        PlayerModel playerModel = (PlayerModel)model;

        sprite.draw();
        sprite.setPositionValue(playerModel.getPosition().getValue());
    }

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