Mooie aanwijzer voor submenu, met mooie spritesheet
This commit is contained in:
+2
-1
@@ -24,6 +24,7 @@ public class Images {
|
||||
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")));
|
||||
images.add(ImageIO.read(Main.class.getResource("/image/aanwijzers4sho.png")));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -34,7 +35,7 @@ public class Images {
|
||||
}
|
||||
|
||||
public enum ImageType {
|
||||
player,player2,pressstart,colorstrike,background
|
||||
player,player2,pressstart,colorstrike,background,aanwijzers
|
||||
}
|
||||
|
||||
public static BufferedImage readImage(File f) {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
@@ -1,10 +1,14 @@
|
||||
package model.gameState;
|
||||
|
||||
import image.Images;
|
||||
import image.Images.ImageType;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.GradientPaint;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -32,6 +36,9 @@ public class MenuState extends GameState {
|
||||
int yPosDiffButton = 900;
|
||||
private int difSelect=0;
|
||||
|
||||
BufferedImage aanwijzers = Images.getImage(ImageType.aanwijzers);
|
||||
int index = 0;
|
||||
|
||||
public MenuState(GameStateManager gsm, SongHandler sh) {
|
||||
super(gsm, sh);
|
||||
buttons = new ArrayList<MenuButton>();
|
||||
@@ -85,6 +92,7 @@ public class MenuState extends GameState {
|
||||
}
|
||||
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,9 +163,12 @@ public class MenuState extends GameState {
|
||||
b.draw(g2);
|
||||
}
|
||||
|
||||
g2.setColor(Color.BLACK);
|
||||
g2.fillRect(865, 425 - difSelect*100, 25, 25);
|
||||
|
||||
int y = (index/5)*75;
|
||||
int x = (index%5)*75;
|
||||
index%=25;
|
||||
BufferedImage subImg = aanwijzers.getSubimage(x, y, 75, 75);
|
||||
g2.drawImage(subImg, 825,900 - difSelect*100,75,75,null);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user