Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.anyspieceofinter.unnamedgameproject.graphics;
- import java.io.IOException;
- import javax.imageio.ImageIO;
- import java.awt.image.BufferedImage;
- public class Spritesheet {
- private String path;
- public final int SIZE;
- public int[] pixels;
- public static Spritesheet enviroment = new Spritesheet("/textures/enviroment.png", 200);
- public Spritesheet (String path, int size) {
- this.path = path;
- SIZE = size;
- pixels = new int[SIZE*SIZE];
- loadImage();
- }
- private void loadImage () {
- try {
- BufferedImage image = ImageIO.read(Spritesheet.class.getResource(path));
- int w = image.getWidth();
- int h = image.getHeight();
- image.getRGB(0, 0, w, h, pixels, 0, w);
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement