package sig.engine; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; public class Sprite{ public final static File SPRITES_FOLDER = new File("..","sprites"); public final static Sprite PROFONT = new Sprite("Profont.png"); public final static Sprite PROFONT_36 = new Sprite("Profont_36.png"); BufferedImage img; int height; int width; public Sprite(java.lang.String filename){ this(new File(SPRITES_FOLDER.getAbsolutePath(),filename)); } Sprite(File filename){ try { BufferedImage img = ImageIO.read(filename); this.width=img.getWidth(); this.height=img.getHeight(); this.img=img; } catch (IOException e) { e.printStackTrace(); } System.out.println("Loaded sprite for "+filename+"."); } public BufferedImage getImg() { return img; } public void setImg(BufferedImage img) { this.img = img; } public int getHeight() { return height; } public int getCanvasHeight() { return height; } public void setHeight(int height) { this.height = height; } public int getWidth() { return width; } public int getCanvasWidth() { return width; } public void setWidth(int width) { this.width = width; } }