Added songs, new libraries and more code

This commit is contained in:
2015-05-29 12:47:25 +02:00
parent 4f4b10fd89
commit 7b21aa1e09
67 changed files with 388 additions and 75 deletions
+32 -22
View File
@@ -1,6 +1,7 @@
package image;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
@@ -8,31 +9,40 @@ import javax.imageio.ImageIO;
import main.Main;
public class Images{
public class Images {
public static ArrayList<BufferedImage> images = new ArrayList<BufferedImage>();
public static ArrayList<BufferedImage> images = new ArrayList<BufferedImage>();
public Images(){
}
public Images() {
static{
try{
images.add(ImageIO.read(Main.class.getResource("/image/player.png")));
images.add(ImageIO.read(Main.class.getResource("/image/player2.png")));
}catch(IOException e){
e.printStackTrace();
}
}
}
public static BufferedImage getImage(ImageType img)
{
return images.get(img.ordinal());
}
static {
try {
images.add(ImageIO.read(Main.class.getResource("/image/player.png")));
images.add(ImageIO.read(Main.class.getResource("/image/player2.png")));
public enum ImageType
{
player,player2
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static BufferedImage getImage(ImageType img) {
return images.get(img.ordinal());
}
public enum ImageType {
player, player2
}
public static BufferedImage readImage(File f) {
BufferedImage bf = null;
try {
bf = ImageIO.read(f);
} catch (IOException e) {
e.printStackTrace();
}
return bf;
}
}