tested multiple windows

This commit is contained in:
Dani The Skunk 2022-09-14 16:26:15 +02:00
parent 4848e5f56a
commit 94245e7689
2 changed files with 14 additions and 4 deletions

View File

@ -7,12 +7,14 @@ public class Test {
public static void main(String[] args) {
var engine = new Engine();
var window = engine.openWindow(1280, 720, "Skunkworks");
var window2 = engine.openWindow(1280, 720, "Skunkworks");
var img = engine.loadImage("C:\\Users\\dani\\Videos\\Screenshot 2022-06-25 17-00-59.png");
//var img = engine.loadImage("C:\\art\\kyoko.png");
System.out.println(img.getPixel(new Vec2i(60, 60)));
while(!window.shouldClose()) {
window.tick();
window2.tick();
}
}
}

View File

@ -10,6 +10,18 @@ import java.nio.ByteBuffer;
import static com.danitheskunk.skunkworks.GraphicsBackend.*;
public class Engine {
GraphicsBackend graphicsBackend;
//Constructors
public Engine() {
this(OPENGL);
}
public Engine(GraphicsBackend graphicsBackend) {
this.graphicsBackend = graphicsBackend;
}
//Methods
public Image loadImage(String path) {
ByteBuffer buf;
byte[] bytes;
@ -27,10 +39,6 @@ public class Engine {
}
public IWindow openWindow(int width, int height, String title) {
return openWindow(width, height, title, OPENGL);
}
public IWindow openWindow(int width, int height, String title, GraphicsBackend graphicsBackend) {
return switch(graphicsBackend) {
case OPENGL -> new GLWindow(width, height, title);
};