helper function for loading texture in basegame
This commit is contained in:
parent
e398f7a095
commit
16fdcee057
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(() -> {
|
||||
|
|
Loading…
Reference in New Issue