Feature/menu
# Conflicts: # model/gameState/MenuState.java # model/objects/MenuButton.java
This commit is contained in:
@@ -15,6 +15,8 @@ import java.awt.Transparency;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.image.VolatileImage;
|
||||
import java.awt.geom.GeneralPath;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import audio.Song;
|
||||
|
||||
@@ -26,10 +28,14 @@ public class MenuButton {
|
||||
|
||||
private boolean selected;
|
||||
private VolatileImage background;
|
||||
|
||||
|
||||
private ArrayList<Color> colors;
|
||||
private int x, y;
|
||||
private boolean selected;
|
||||
private Song song;
|
||||
Color color;
|
||||
|
||||
public MenuButton(int x, int y, double scale, int rounding, Color c0, Song song){
|
||||
public MenuButton(int x, int y, Color color, Song song){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.scalefactor = scale;
|
||||
@@ -75,12 +81,46 @@ public class MenuButton {
|
||||
g2d.fill(arrayToGeneralpath(new int[][]{{118, 88}, {114, 48},{78, 25+rounding}, {82, 73+rounding}}));
|
||||
g2d.setColor(buttoncolor);
|
||||
g2d.fill(arrayToGeneralpath(new int[][]{{78, 25+rounding}, {82, 73+rounding},{15, 88+(int)(rounding*0.5)}, {10, 43+(int)(rounding*0.5)}}));
|
||||
this.color = color;
|
||||
setSong(song);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void draw(Graphics2D g2d){
|
||||
|
||||
|
||||
if(selected){
|
||||
g2d.setStroke(new BasicStroke(4));
|
||||
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.setColor(Color.BLACK);
|
||||
g2d.draw(border);
|
||||
g2d.draw(path);
|
||||
|
||||
g2d.setColor(color.darker().darker().darker().darker());
|
||||
g2d.fillRect(x-10, y-10,900,90);
|
||||
}
|
||||
g2d.setColor(color.darker().darker());
|
||||
g2d.fillRect(x-5, y-5,890,80);
|
||||
g2d.setColor(color);
|
||||
g2d.fillRect(x,y,880,70);
|
||||
>>>>>>> 7dd4066a8ab297001a5e0e35d877aff3f29525ac
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
g2d.setPaint(gradient);
|
||||
g2d.fill(line);
|
||||
|
||||
@@ -110,6 +150,14 @@ public class MenuButton {
|
||||
|
||||
public void update(){
|
||||
}
|
||||
|
||||
//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);
|
||||
}
|
||||
|
||||
|
||||
public void setSelected(boolean selected) {
|
||||
this.selected = selected;
|
||||
|
||||
Reference in New Issue
Block a user