Feature/menu
Conflicts: audio/AudioPlayer.java model/GameModel.java model/SongHandler.java model/gameState/MenuState.java Menu now works togheter with the game. A lot of known bugs with audio player
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package model.objects;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
public class DifficultyButton {
|
||||
|
||||
private int x = 900;
|
||||
private int y;
|
||||
private String str;
|
||||
private Color color;
|
||||
|
||||
|
||||
public DifficultyButton(int y, String str, Color color) {
|
||||
this.y = y;
|
||||
this.str = str;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void draw(Graphics2D g2) {
|
||||
g2.setColor(Color.WHITE);
|
||||
g2.fillRect(x, y, 300, 75);
|
||||
g2.setColor(Color.ORANGE);
|
||||
g2.drawRect(x, y, 300, 75);
|
||||
g2.drawRect(x-2, y-2, 304, 79);
|
||||
|
||||
g2.setColor(color);
|
||||
Font textFont2 = new Font("OCR A Extended", Font.BOLD, 50);
|
||||
g2.setFont(textFont2);
|
||||
|
||||
g2.drawString(str, x+5, y+50);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,8 @@ import java.awt.geom.GeneralPath;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import audio.Song;
|
||||
|
||||
public class MenuButton {
|
||||
|
||||
private ArrayList<GeneralPath> buttonparts;
|
||||
@@ -18,18 +20,19 @@ public class MenuButton {
|
||||
private Paint gradient;
|
||||
private int x, y, rounding;
|
||||
private double scalefactor;
|
||||
private String text;
|
||||
|
||||
private boolean selected;
|
||||
private int fadecounter;
|
||||
|
||||
public MenuButton(int x, int y, double scale, String text, int rounding, Color c0){
|
||||
private Song song;
|
||||
|
||||
public MenuButton(int x, int y, double scale, int rounding, Color c0, Song song){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.scalefactor = scale;
|
||||
this.text = text;
|
||||
this.rounding = rounding;
|
||||
calculateButton();
|
||||
setSong(song);
|
||||
|
||||
colors = new ArrayList<Color>();
|
||||
|
||||
@@ -98,15 +101,15 @@ public class MenuButton {
|
||||
g2d.setFont(textFont);
|
||||
g2d.translate((x+160)*scalefactor, (y+74)*scalefactor);
|
||||
g2d.rotate(-0.1);
|
||||
g2d.drawString(text, 0, 0);
|
||||
g2d.drawString(song.getTitle(), 0, 0);
|
||||
g2d.rotate(0.1);
|
||||
g2d.translate(-(x+160)*scalefactor, -(y+74)*scalefactor);
|
||||
}
|
||||
|
||||
public void update(){
|
||||
if(selected && fadecounter < 5){
|
||||
x -= 8;
|
||||
y -=8;
|
||||
x += 8;
|
||||
y -= 8;
|
||||
scalefactor += 0.04;
|
||||
fadecounter++;
|
||||
calculateButton();
|
||||
@@ -134,6 +137,12 @@ public class MenuButton {
|
||||
public int getX() {
|
||||
return x;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Song getSong() {
|
||||
return song;
|
||||
}
|
||||
|
||||
public void setSong(Song song) {
|
||||
this.song = song;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user