diff --git a/GameEngine/src/main/java/gameEngine/entites/gameComponents/Mesh.java b/GameEngine/src/main/java/gameEngine/entites/gameComponents/Mesh.java index 911b554..c0246fa 100644 --- a/GameEngine/src/main/java/gameEngine/entites/gameComponents/Mesh.java +++ b/GameEngine/src/main/java/gameEngine/entites/gameComponents/Mesh.java @@ -23,7 +23,7 @@ this.parent = parent; this.type = type; if (type == MeshType.SPRITE) { - this.texture = new Texture("GameEngine/resources/" + texturePath); // Load the image + this.texture = new Texture(texturePath); // Load the image } } @@ -37,11 +37,16 @@ @Override public void update() { if (type == MeshType.SPRITE) { + Integer id = texture.getId(); + if(id == null){ + texture.init(); + } renderSprite(); // スプライトの描画 } } public void setTexturePath(String texturePath){ + this.texture = new Texture(texturePath); } private void renderSprite() {