Bläddra i källkod

Submenu fix, songselect fix

Dofensmirtsz 10 år sedan
förälder
incheckning
e979252aae
2 ändrade filer med 31 tillägg och 29 borttagningar
  1. 5 4
      model/gameState/MenuState.java
  2. 26 25
      model/objects/MenuButton.java

+ 5 - 4
model/gameState/MenuState.java

@@ -126,7 +126,7 @@ public class MenuState extends GameState {
 		buttons.clear();		
 		buttons.add(new MenuButton(400,250,GameModel.colors[kleurButton1],selectedToSong(selected-2)));
 		buttons.add(new MenuButton(400,390,GameModel.colors[kleurButton2],selectedToSong(selected-1)));
-		buttons.add(new MenuButton(400,530,GameModel.colors[kleurButton3],selectedToSong(selected)));
+		buttons.add(new MenuButton(360,525,920,80,GameModel.colors[kleurButton3],selectedToSong(selected)));
 		buttons.add(new MenuButton(400,670,GameModel.colors[kleurButton4],selectedToSong(selected+1)));
 		buttons.add(new MenuButton(400,810,GameModel.colors[kleurButton5],selectedToSong(selected+2)));
 		buttons.get(2).setSelected(true);
@@ -345,9 +345,10 @@ public class MenuState extends GameState {
 		
 		
 		g2.setColor(Color.WHITE);
-		g2.drawString("Overall Highscore: " + "", 30, 200);
-		g2.drawString("Daily Highscore: " + "", 30, 300);
-		g2.drawString("Beats per Minute: " + selectedToSong(selected).getBPM(), 30, 400);
+		g2.drawString("Author: " + selectedToSong(selected).getAuthor(), 30, 200);
+		g2.drawString("Overall Highscore: " + "", 30, 300);
+		g2.drawString("Daily Highscore: " + "", 30, 400);
+		g2.drawString("Personal Highscore: " + "", 30, 500);
 		
 		for(DifficultyButton b : buttons2){
 			b.draw(g2);

+ 26 - 25
model/objects/MenuButton.java

@@ -12,6 +12,7 @@ public class MenuButton {
 
 	private ArrayList<Color> colors;
 	private int x, y;
+	private int xx,yy;
 	private boolean selected; 
 	private Song song;
 	Color color;
@@ -24,45 +25,45 @@ public class MenuButton {
 		
 	}
 	
-	
+	public MenuButton(int x, int y, int xx, int yy, Color color, Song song){
+		this.x = x;
+		this.y = y;
+		this.color = color;
+		this.yy = yy;
+		this.xx = xx;
+		setSong(song);
+	}
 
 	public void draw(Graphics2D g2d){
 
 		
 		if(selected){
+			g2d.setColor(color.darker().darker().darker().darker());
+			g2d.fillRect(x-10, y-10,xx+20,yy+20);
+			g2d.setColor(color.darker().darker());
+			g2d.fillRect(x-5, y-5,xx+10,yy+10);
 			g2d.setColor(color);
-			GeneralPath path = new GeneralPath();
-			path.moveTo(320, 540);
-			path.lineTo(320, 590);
-			path.lineTo(385, 565);
-			
-			path.closePath();
-			g2d.fill(path);
-			
+			g2d.fillRect(x,y,xx,yy);
 			g2d.setColor(Color.BLACK);
-			g2d.draw(path);
-			
-			g2d.setColor(color.darker().darker().darker().darker());
-			g2d.fillRect(x-10, y-10,900,90);
+			g2d.drawRect(x-10, y-10, xx+20, yy+20);
+			g2d.drawRect(x-5, y-5, xx+10, yy+10);
+			g2d.drawRect(x, y, xx, yy);
 		}
-		g2d.setColor(color.darker().darker());
-		g2d.fillRect(x-5, y-5,890,80);
-		g2d.setColor(color);
-		g2d.fillRect(x,y,880,70);
-		
-		if(selected){
-			g2d.setColor(Color.BLACK);
-			g2d.drawRect(x-10, y-10, 900, 90);
-			g2d.drawRect(x-5, y-5, 890, 80);
-			g2d.drawRect(x, y, 880, 70);
-			
+		else{
+			g2d.setColor(color.darker().darker());
+			g2d.fillRect(x-5, y-5,890,80);
+			g2d.setColor(color);
+			g2d.fillRect(x,y,880,70);
 		}
 
 		//draw text
 		g2d.setColor(Color.BLACK);
 		Font textFont = new Font("OCR A Extended", Font.BOLD,60);
 		g2d.setFont(textFont);
-		g2d.drawString(song.getTitle(),  x+50, y+57);
+		if(selected)
+			g2d.drawString(song.getTitle(),  x+50, y+63);
+		else
+			g2d.drawString(song.getTitle(),  x+50, y+57);
 	}