implemented Engine.loadBytes

This commit is contained in:
DaniTheSkunk 2022-09-20 23:25:15 +02:00
parent 07ced1f430
commit fd42674cee
1 changed files with 5 additions and 2 deletions

View File

@ -21,7 +21,7 @@ public class Engine {
} }
//Methods //Methods
public Image loadImage(String path) { public ByteBuffer loadBytes(String path) {
ByteBuffer buf; ByteBuffer buf;
byte[] bytes; byte[] bytes;
try(FileInputStream fis = new FileInputStream(path)) { try(FileInputStream fis = new FileInputStream(path)) {
@ -32,7 +32,10 @@ public class Engine {
buf = BufferUtils.createByteBuffer(bytes.length); buf = BufferUtils.createByteBuffer(bytes.length);
buf.put(bytes); buf.put(bytes);
buf.flip(); buf.flip();
return new Image(buf); return buf;
}
public Image loadImage(String path) {
return new Image(loadBytes(path));
} }
public IWindow openWindow(Vec2i size, String title) { public IWindow openWindow(Vec2i size, String title) {