package views; import entities.*; import models.IModel; import models.PlayerModel; //--------------------------------------------------------------- // public class PlayerRenderer implements IView { private Sprite sprite; //--------------------------------------------------------------- //--------------------------------------------------------------- public PlayerRenderer(String path, double scale) { this.sprite = new Sprite(path); this.sprite.setScaleValue(scale); } //--------------------------------------------------------------- //--------------------------------------------------------------- // PlayerModelから座標を取得して描画する public void display(IModel model) { // Modelがキャスト可能か判定 if (model instanceof PlayerModel) { PlayerModel playerModel = (PlayerModel) model; sprite.setPositionValue(playerModel.getPosition().getValue()); } sprite.draw(); } //--------------------------------------------------------------- // テクスチャの開放 public void delete() { sprite.delete(); } //--------------------------------------------------------------- }