package views; import entities.Pair; 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(0.1); this.sprite.setPositionValue(new Pair<>(640d, 480d)); } //--------------------------------------------------------------- //--------------------------------------------------------------- // @Override public void update(IModel model) { JumpGameModel jumpGameModel = (JumpGameModel) model; double x = this.sprite.getPositionValue().getFirst(); double y = 112 + jumpGameModel.getPosition().getSecond(); this.sprite.setPositionValue(new Pair<>(x, y)); } //--------------------------------------------------------------- // 描画する @Override public void display() { sprite.draw(); } //--------------------------------------------------------------- // テクスチャの開放 @Override public void delete() { sprite.delete(); } //--------------------------------------------------------------- }