Skip to content

Instantly share code, notes, and snippets.

@sylvia43
Last active August 29, 2015 14:00
Show Gist options
  • Save sylvia43/bd513c2a17c4b33c9357 to your computer and use it in GitHub Desktop.
Save sylvia43/bd513c2a17c4b33c9357 to your computer and use it in GitHub Desktop.
public enum ImageLibrary {
INFANTRY_SPRITE("infantry.png"),
TANK_SPRITE("tank.png");
BufferedImage img;
ImageLibrary(String filepath) {
try {
img = ImageIO.read(new File(filepath));
} catch (IOException e) {
throw new RuntimeException("Could not load a file: " + e);
}
}
public BufferedImage getImage() {
return img;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment