Co-authored-by: r3cp3ct <45179536+r3cp3ct@users.noreply.github.com>main
parent
9136dd58bf
commit
20eea068eb
@ -1,8 +1,29 @@ |
||||
package sig.engine; |
||||
|
||||
public class Sprite{ |
||||
int height; |
||||
int width; |
||||
int[] bi_array; |
||||
import java.awt.image.BufferedImage; |
||||
import java.io.IOException; |
||||
import java.nio.file.Path; |
||||
|
||||
import javax.imageio.ImageIO; |
||||
|
||||
public enum Sprite{ |
||||
NANA(Path.of("..","3x.png")); |
||||
BufferedImage img; |
||||
int height; |
||||
int width; |
||||
int[] bi_array; |
||||
|
||||
Sprite(Path filename){ |
||||
try { |
||||
BufferedImage img = ImageIO.read(filename.toFile()); |
||||
this.width=img.getWidth(); |
||||
this.height=img.getHeight(); |
||||
this.bi_array = new int[width*height]; |
||||
img.getRGB(0,0,width,height,this.bi_array,0,width); |
||||
} catch (IOException e) { |
||||
e.printStackTrace(); |
||||
} |
||||
System.out.println("Loaded sprite for "+this+"."); |
||||
}; |
||||
|
||||
} |
Loading…
Reference in new issue