helper function for loading texture in basegame

This commit is contained in:
DaniTheSkunk 2022-10-15 05:54:44 +00:00
parent e398f7a095
commit 16fdcee057
2 changed files with 6 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import com.danitheskunk.skunkworks.audio.nodes.Mixer;
import com.danitheskunk.skunkworks.audio.nodes.Node;
import com.danitheskunk.skunkworks.audio.nodes.SamplePlayer;
import com.danitheskunk.skunkworks.gfx.IRenderContext;
import com.danitheskunk.skunkworks.gfx.ITexture;
import com.danitheskunk.skunkworks.gfx.font.IFont;
import com.danitheskunk.skunkworks.nodes.NodeRoot;
import org.lwjgl.glfw.GLFW;
@ -84,4 +85,8 @@ public abstract class BaseGame {
protected void playSample(ISample sample, boolean looping) {
samplePlayer.play(sample, looping);
}
protected ITexture loadTexture(String path) {
return window.loadTexture(path);
}
}

View File

@ -11,10 +11,8 @@ public class TestNode extends BaseGame {
super(new Vec2i(1280, 720), "Skunkworks");
kick = loadSample("demoassets/kick.wav");
playSample(kick);
sprite = new NodeSprite();
sprite.setTexture(window.loadTexture("demoassets/test.png"));
sprite.setTexture(loadTexture("demoassets/test.png"));
sprite.setPos(new Vec2f(100, 100));
rootNode.add(sprite);
sprite.tweenPos(new Vec2f(800, 400), 120).delay(60).then(() -> {