Added SongInstanceDifficultyButtons :)))))))

This commit is contained in:
Dofensmirtsz
2015-06-04 13:48:49 +02:00
parent 65e5cb3eac
commit 5f8e7706f2
4 changed files with 18 additions and 10 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ public class Song {
private BufferedImage bannerImage;
private AudioInputStream audioStream;
private List<SongInstance> songs;
public List<SongInstance> songs;
public Song() {
title = "";
+3 -1
View File
@@ -26,7 +26,7 @@ public class SongHandler {
songs = new ArrayList<Song>();
currentSong = null;
currentIndex = -1;
currentIndex = 0;
p = new AudioPlayer();
@@ -36,6 +36,8 @@ public class SongHandler {
dir = new File(System.getProperty( "user.home" ) + "/Documents/songs");
songs = DirScanner.scanDirectories(dir);
updatePlayer();
}
public void next()
+13 -8
View File
@@ -11,9 +11,8 @@ import model.SongHandler;
import model.objects.DifficultyButton;
import model.objects.MenuButton;
import audio.Song;
import audio.SongInstance;
import control.GameStateManager;
import control.GameStateManager.State;
import control.button.Button;
import control.button.ButtonEvent;
import control.joystick.Joystick;
import control.joystick.JoystickEvent;
@@ -28,7 +27,9 @@ public class MenuState extends GameState {
private int animationcounter;
private boolean subscreen, startanimation;
private int z;
int z;
int yPosDiffButton = 900;
public MenuState(GameStateManager gsm, SongHandler sh) {
super(gsm, sh);
@@ -45,14 +46,10 @@ public class MenuState extends GameState {
buttons.add(new MenuButton(-600, 450, 1.7, 30, Color.WHITE,selectedToSong(selected+2)));
buttons.get(2).setSelected(true);
buttons2.add(new DifficultyButton(600 ,"Beginner", Color.BLUE));
buttons2.add(new DifficultyButton(700 ,"Easy", Color.GREEN));
buttons2.add(new DifficultyButton(800 ,"Normal", Color.orange));
buttons2.add(new DifficultyButton(900 ,"Hard", Color.RED));
}
@Override
public void init() {
}
@Override
@@ -76,6 +73,14 @@ public class MenuState extends GameState {
z=i;
}
oldselected = selected;
buttons2.clear();
int instanceNr = 0;
for(SongInstance si : sh.getCurrentSong().getSongs()){
buttons2.add(new DifficultyButton(yPosDiffButton-instanceNr,si.getDifficulty(), Color.BLUE));
instanceNr += 100;
System.out.println(sh.getCurrentSong().getSongs().size());
}
}
}
+1
View File
@@ -32,4 +32,5 @@ public class DifficultyButton {
g2.drawString(str, x+5, y+50);
}
}