Newer
Older
JumpingGame / src / main / java / views / PlayerRenderer.java
k-fujii on 15 Nov 2021 1022 bytes entity→entitiesに変更
package views;

import entities.Image2D;
import entities.Texture;
import entities.Vec2;

//---------------------------------------------------------------
//
public class PlayerRenderer implements IView {

    private Texture texture;
    private Image2D img;

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    //
    public PlayerRenderer(String path, Vec2 position) {
        texture = new Texture("player", path);
        img = new Image2D(texture, position.getX(), position.getY());
    }

    //---------------------------------------------------------------
    //---------------------------------------------------------------
    //
    public void display() {
        img.draw();
    }

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