Feature/json
# Conflicts: # control/GameStateManager.java # image/Images.java # main/Window.java # model/gameState/MenuState.java
This commit is contained in:
+34
-25
@@ -1,6 +1,7 @@
|
||||
package image;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -8,34 +9,42 @@ 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")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/pressstart.png")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/colorstrike.png")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/background.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")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/pressstart.png")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/colorstrike.png")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/background.png")));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public enum ImageType
|
||||
{
|
||||
player,player2,pressstart,colorstrike,background
|
||||
}
|
||||
public static BufferedImage getImage(ImageType img) {
|
||||
return images.get(img.ordinal());
|
||||
}
|
||||
|
||||
public enum ImageType {
|
||||
player,player2,pressstart,colorstrike,background
|
||||
}
|
||||
|
||||
public static BufferedImage readImage(File f) {
|
||||
BufferedImage bf = null;
|
||||
try {
|
||||
bf = ImageIO.read(f);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return bf;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user