Browse Source

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
jancoow 10 năm trước cách đây
mục cha
commit
396769317c
74 tập tin đã thay đổi với 334 bổ sung315 xóa
  1. 25 29
      audio/AudioPlayer.java
  2. 1 1
      audio/Song.java
  3. 2 5
      control/GameStateManager.java
  4. 2 1
      image/Images.java
  5. BIN
      image/aanwijzers4sho.png
  6. 1 1
      model/GameModel.java
  7. 3 12
      model/SongHandler.java
  8. 204 42
      model/gameState/MenuState.java
  9. 0 56
      model/gameState/PickSongState.java
  10. 6 0
      model/gameState/PlayState.java
  11. 35 16
      model/gameState/TitleState.java
  12. 36 0
      model/objects/DifficultyButton.java
  13. 17 8
      model/objects/MenuButton.java
  14. BIN
      songs/Card_Captor_Sakura-_Catch_You_Catch_Me/CCSIntro.mp3
  15. 0 0
      songs/Card_Captor_Sakura-_Catch_You_Catch_Me/Card_Captor_Sakura-_Catch_You_Catch_Me.csf
  16. BIN
      songs/Card_Captor_Sakura-_Catch_You_Catch_Me/SakuraBG.png
  17. BIN
      songs/Card_Captor_Sakura-_Catch_You_Catch_Me/SakuraLogo.png
  18. 0 0
      songs/Chobits-_Let_Me_Be_With_You/Chobits-_Let_Me_Be_With_You.csf
  19. BIN
      songs/Chobits-_Let_Me_Be_With_You/ChobitsIntro.mp3
  20. BIN
      songs/Chobits-_Let_Me_Be_With_You/Chobitsbg1.png
  21. BIN
      songs/Chobits-_Let_Me_Be_With_You/Chobitslogo.png
  22. 0 0
      songs/Excel_Saga-_Excel's_Theme/Excel_Saga-_Excel's_Theme.csf
  23. BIN
      songs/Excel_Saga-_Excel's_Theme/excel-bg.png
  24. BIN
      songs/Excel_Saga-_Excel's_Theme/excel-logo.png
  25. BIN
      songs/Excel_Saga-_Excel's_Theme/excel.mp3
  26. BIN
      songs/Hand_Maid_May-_Jump_Meippai_Dakishimete!/HandMaidMayIntro.mp3
  27. 0 0
      songs/Hand_Maid_May-_Jump_Meippai_Dakishimete!/Hand_Maid_May-_Jump_Meippai_Dakishimete!.csf
  28. BIN
      songs/Hand_Maid_May-_Jump_Meippai_Dakishimete!/MayBG.png
  29. BIN
      songs/Hand_Maid_May-_Jump_Meippai_Dakishimete!/MayLogo.png
  30. 0 0
      songs/Love_Hina-_Sakura_Saku/Love_Hina-_Sakura_Saku.csf
  31. BIN
      songs/Love_Hina-_Sakura_Saku/sakurasaku-bg.png
  32. BIN
      songs/Love_Hina-_Sakura_Saku/sakurasaku.mp3
  33. BIN
      songs/Love_Hina-_Sakura_Saku/sakurasakulogo.png
  34. BIN
      songs/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix]/LoveHinaBG.png
  35. BIN
      songs/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix]/LoveHinaLogo.png
  36. 0 0
      songs/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix]/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix].csf
  37. BIN
      songs/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix]/SakuraSaku.mp3
  38. BIN
      songs/Love_Hina_Again-_Kirari_Takaramono/LoveHinaAgain.mp3
  39. BIN
      songs/Love_Hina_Again-_Kirari_Takaramono/LoveHinaAgainBG.png
  40. BIN
      songs/Love_Hina_Again-_Kirari_Takaramono/LoveHinaAgainLogo.png
  41. 0 0
      songs/Love_Hina_Again-_Kirari_Takaramono/Love_Hina_Again-_Kirari_Takaramono.csf
  42. BIN
      songs/Mahoromatic-_Mahoro_De_Mambo/Mahoro.mp3
  43. BIN
      songs/Mahoromatic-_Mahoro_De_Mambo/MahoroBG.png
  44. BIN
      songs/Mahoromatic-_Mahoro_De_Mambo/MahoroLogo.png
  45. 0 0
      songs/Mahoromatic-_Mahoro_De_Mambo/Mahoromatic-_Mahoro_De_Mambo.csf
  46. 0 72
      songs/NAME_OF_SONG/NAME_OF_SONG.csf
  47. BIN
      songs/NAME_OF_SONG/NAME_OF_SONG.mp3
  48. BIN
      songs/NAME_OF_SONG/background.png
  49. BIN
      songs/NAME_OF_SONG/banner.png
  50. BIN
      songs/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix]/EvaBG.png
  51. BIN
      songs/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix]/EvaLogo.png
  52. BIN
      songs/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix]/Evangelion.mp3
  53. 0 0
      songs/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix]/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix].csf
  54. 0 0
      songs/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit)/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit).csf
  55. BIN
      songs/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit)/freckles.mp3
  56. BIN
      songs/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit)/rk-bg.png
  57. BIN
      songs/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit)/rk-logo.png
  58. 0 72
      songs/SECOND_SONG/NAME_OF_SONG.csf
  59. BIN
      songs/SECOND_SONG/NAME_OF_SONG.mp3
  60. BIN
      songs/SECOND_SONG/background.png
  61. BIN
      songs/SECOND_SONG/banner.png
  62. BIN
      songs/Sister_Princess-_Love_Destiny/SPBg1.png
  63. BIN
      songs/Sister_Princess-_Love_Destiny/SPLogo.png
  64. BIN
      songs/Sister_Princess-_Love_Destiny/SisterPrincessIntro.mp3
  65. 0 0
      songs/Sister_Princess-_Love_Destiny/Sister_Princess-_Love_Destiny.csf
  66. 0 0
      songs/Slayers-_Midnight_Blue/Slayers-_Midnight_Blue.csf
  67. BIN
      songs/Slayers-_Midnight_Blue/SlayersLogo.png
  68. BIN
      songs/Slayers-_Midnight_Blue/SlayersMovieTheme.mp3
  69. BIN
      songs/Slayers-_Midnight_Blue/Slayersbg.PNG
  70. 0 0
      songs/Vandread-_Trust/Vandread-_Trust.csf
  71. BIN
      songs/Vandread-_Trust/VandreadBG1.png
  72. BIN
      songs/Vandread-_Trust/VandreadIntro.mp3
  73. BIN
      songs/Vandread-_Trust/VandreadLogo.png
  74. 2 0
      view/GameView.java

+ 25 - 29
audio/AudioPlayer.java

@@ -1,6 +1,8 @@
 package audio;
 
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
 
 import javazoom.jl.decoder.JavaLayerException;
 import javazoom.jl.player.Player;
@@ -9,6 +11,8 @@ public class AudioPlayer{
 
 	private Player clip;
 	private FileInputStream fis;
+	private Song s;
+	private Thread thread;
 
 	public AudioPlayer() {
 		clip = null;
@@ -16,20 +20,22 @@ public class AudioPlayer{
 
 	public void setClip(Song s) {
 		try {
-			if(clip != null){
+			if(clip!=null)
 				clip.close();
-			}
-			fis = new FileInputStream(s.getAudio());
-			clip = new Player(fis);
+			this.s = s;
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 	}
 
 	public void play() {
-		if (clip == null)
-			return;
-		new Thread(new Runnable() {
+		try {
+			fis = new FileInputStream(s.getAudio());
+			clip = new Player(fis);
+		} catch (JavaLayerException | FileNotFoundException e1) {
+			e1.printStackTrace();
+		}
+		 Thread thread = new Thread(new Runnable() {
 			@Override
 			public void run() {
 				if(clip != null){
@@ -39,38 +45,28 @@ public class AudioPlayer{
 						e.printStackTrace();
 					}
 				}
-			}}).start();
-		
+			}});
+		 thread.start();
 	}
 
-	
-	public void play(final int framePosition) {
-		if (clip == null)
-			return;	
-		new Thread(new Runnable() {
-			@Override
-			public void run() {
-				if(clip != null){
-					try {
-						clip.play(framePosition);
-					} catch (JavaLayerException e) {
-						e.printStackTrace();
-					}
-				}
-			}}).start();
-
-	}
-
-
 	public void close() {
 		if(clip != null)
 		{
 			clip.close();
 			clip = null;
-			fis = null;
+			try {
+				if(fis != null)
+					fis.close();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			if(thread != null && thread.isAlive())
+				thread.stop();
 		}
 	}
 	
+
+	
 	public long getProgress()
 	{
 		if(clip != null)

+ 1 - 1
audio/Song.java

@@ -28,7 +28,7 @@ public class Song {
 	private BufferedImage backgroundImage;
 	private BufferedImage bannerImage;
 
-	private List<SongInstance> songs;
+	public List<SongInstance> songs;
 
 	public Song() {
 		title = "";

+ 2 - 5
control/GameStateManager.java

@@ -6,9 +6,8 @@ import java.util.List;
 import model.SongHandler;
 import model.gameState.GameState;
 import model.gameState.MenuState;
-import model.gameState.TitleState;
-import model.gameState.PickSongState;
 import model.gameState.PlayState;
+import model.gameState.TitleState;
 
 public class GameStateManager {
 
@@ -19,8 +18,7 @@ public class GameStateManager {
 	public enum State {
 		TITLE_STATE,
 		MENU_STATE,
-		PLAY_STATE,
-		PICKSONG_STATE
+		PLAY_STATE
 	}
 	
 	public GameStateManager(SongHandler sh){
@@ -28,7 +26,6 @@ public class GameStateManager {
 		gamestates.add(new TitleState(this, sh));
 		gamestates.add(new MenuState(this, sh));
 		gamestates.add(new PlayState(this, sh));
-		gamestates.add(new PickSongState(this, sh));
 		currentState = gamestates.get(0);
 	}
 	

+ 2 - 1
image/Images.java

@@ -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) {

BIN
image/aanwijzers4sho.png


+ 1 - 1
model/GameModel.java

@@ -7,7 +7,7 @@ import control.button.ButtonHandler;
 
 public class GameModel{
 	
-	public static Color[] colors = {Color.MAGENTA,Color.RED,Color.GREEN,Color.YELLOW,Color.CYAN,Color.WHITE};
+	public static Color[] colors = {Color.GREEN,Color.YELLOW,Color.RED,Color.MAGENTA,Color.CYAN,Color.WHITE};
 	private GameStateManager gsm;
 	private SongHandler sh;	
 	

+ 3 - 12
model/SongHandler.java

@@ -54,11 +54,8 @@ public class SongHandler {
 	}
 	public void set(int i)
 	{
-		if(currentIndex != i)
-		{
-			currentIndex = i;
-			updatePlayer();
-		}
+		currentIndex = i;
+		updatePlayer();
 	}
 	public void set(SongInstance si)
 	{
@@ -112,11 +109,5 @@ public class SongHandler {
 		p.play();
 	}
 	
-	public void play(boolean b)
-	{
-		if(b)
-		{
-			p.play((int)currentSong.getSampleStart()*10);
-		}
-	}
+	
 }

+ 204 - 42
model/gameState/MenuState.java

@@ -4,66 +4,195 @@ 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;
 
+import com.sun.glass.ui.EventLoop.State;
+
+import model.GameModel;
 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.ButtonEvent;
 import control.joystick.Joystick;
 import control.joystick.JoystickEvent;
 
 public class MenuState extends GameState {
+	private ArrayList<MenuButton> buttons;
+	private ArrayList<DifficultyButton> buttons2;
+	private int selected, oldselected;
+	private List<Song> songs;
+	private Polygon triangle,triangle2;
 
-    int frame = 0;
-    int maxFrames = 2560;
-    int animationcounter;
-    
-    ArrayList<MenuButton> buttons;
-	int selected;
-    
+	private int animationcounter;
+	private boolean subscreen, startanimation;
+	
+	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>();
-		buttons.add(new MenuButton(-600, 50,1.7,	"Quick play", 0, Color.green));
-		buttons.add(new MenuButton(-600, 150, 1.7, "Pick song", 10, new Color(60,60,255)));
-		buttons.add(new MenuButton(-600, 250, 1.7, "Best played", 20, Color.red));
-		buttons.add(new MenuButton(-600, 350, 1.7, "Last played", 30, Color.yellow));
+		buttons2 = new ArrayList<DifficultyButton>();
+		this.songs = sh.getSongs();
+		startanimation = true;
+		subscreen = false;
+		
+		buttons.add(new MenuButton(-600, 50,1.7, 0, Color.green, selectedToSong(selected-2) ));
+		buttons.add(new MenuButton(-600, 150, 1.7, 10, Color.BLUE, selectedToSong(selected-1)));
+		buttons.add(new MenuButton(-600, 250, 1.7, 20, Color.red, selectedToSong(selected)));
+		buttons.add(new MenuButton(-600, 350, 1.7, 30, Color.yellow,selectedToSong(selected+1)));
+		buttons.add(new MenuButton(-600, 450, 1.7, 30, Color.WHITE,selectedToSong(selected+2)));
+		buttons.get(2).setSelected(true);
+		
 	}
 	@Override
 	public void init() {
-		// TODO Auto-generated method stub
-		sh.play(true);
+		
 	}
 
 	@Override
 	public void update(float factor) {
-		buttonInAnimation(animationcounter);
+		if(startanimation){
+			buttonInAnimation(animationcounter);
+			if(animationcounter == 5){
+				startanimation = false;
+			}
+		}else if(subscreen){
+			nextScreen();
+		}else{
+			previousScreen();
+		}
 	     for(MenuButton b:buttons){
 	    	 b.update();
 	     }
-	     frame++;
+	     if(selected != oldselected){
+	    	 for(int i = 0; i < buttons.size(); i++){
+		    	 buttons.get(i).setSong(selectedToSong(selected+(i-2)));
+	    	 }
+	    	 oldselected = selected;
+	    	 
+	    	buttons2.clear();
+	 		int instanceNr = 0;
+	 		for(int i = sh.getCurrentSong().getSongs().size(); i>0; i--){
+	 			if(sh.getCurrentSong().getSongs().size() == 0)
+	 				continue;
+	 			SongInstance si = sh.getCurrentSong().getSongs().get(i-1);
+	 			buttons2.add(new DifficultyButton(yPosDiffButton-instanceNr,si.getDifficulty(), GameModel.colors[i-1]));
+	 			instanceNr += 100;
+	 		}
+	 		
+	     }
+	     index++;
 	}
 
 	@Override
 	public void draw(Graphics2D g2) {
-	    g2.drawImage(Images.getImage(ImageType.background), -640 -((frame * 4) % maxFrames), 0, 5120, 1024, null); 
-		for(MenuButton b:buttons){
-	    	 b.draw(g2);
-	     }	   
+
+	    
+		g2.setColor(Color.BLACK);
+		Font textFont2 = new Font("OCR A Extended", Font.BOLD, 50);
+		g2.setFont(textFont2);
+		
+		
+		if(!subscreen) {
+			GradientPaint gp = new GradientPaint(0, 0, new Color(0,0,1, 0.6f),1280,1024 ,new Color(0,0,1, 0.2f));
+			g2.setPaint(gp);
+			g2.fillRect(0, 0, 1280, 1024);
+			
+			
 			
+			triangle2 = new Polygon();
+			triangle2.addPoint(0, 0);
+			triangle2.addPoint(0, 1024/4+50);
+			triangle2.addPoint(1280/2+50, 0);
+			
+			
+			
+		    triangle = new Polygon();
+		    triangle.addPoint(0, 0);
+		    triangle.addPoint(0, 1024/4);
+		    triangle.addPoint(1280/2, 0);	    
+		    
+		    
+			for(MenuButton b:buttons){
+		    	 b.draw(g2);
+		     }
+			
+			
+			GradientPaint gp2 = new GradientPaint(0, 0, new Color(1,1,0, 0.6f),1280,1024 ,new Color(0,0,1, 0.2f));
+			g2.setPaint(gp2);
+			g2.fillPolygon(triangle2);
+			
+			g2.setColor(Color.ORANGE);
+			g2.fillPolygon(triangle);
+			
+			g2.setColor(Color.BLACK);
+			g2.drawString("Main Menu", 30, 60);
+		}
+		
+		if(subscreen) {
+			//g2.setColor(Color.BLACK);
+			GradientPaint gp3 = new GradientPaint(640, 1024/8,Color.BLUE,640,1024 ,Color.WHITE);
+			g2.setPaint(gp3);
+			g2.fillRect(0, 0, 1280, 1024);
+			GradientPaint gp4 = new GradientPaint(0, 0,new Color(1,1,0,0.6f),1280,1024,new Color(1,1,1,0.2f));
+			g2.setPaint(gp4);
+			g2.fillRect(0,128,1280,25);
+			g2.setColor(Color.ORANGE);
+			g2.fillRect(0, 0, 1280, 1024/8);
+			g2.setColor(Color.BLACK);
+			g2.drawString(selectedToSong(selected).getTitle(), 30, 60);
+			
+			
+			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);
+			
+			for(DifficultyButton b : buttons2){
+				b.draw(g2);
+			}
+			
+			
+			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);
+			
+		}
+		
+
 	}
 	
 	@Override
 	public void buttonPressed(ButtonEvent e) {
-		if(e.getButton().getButtonID() == 1){
-			for(MenuButton b:buttons){
-				if(b.isSelected()){
-					gsm.setState(State.PLAY_STATE);
-				}
+		if(subscreen){								//Screen for Song details
+			if(e.getButton().getButtonID() == 2){
+				subscreen = false;
+			}
+			if(e.getButton().getButtonID() == 1){
+				sh.close();
+				gsm.setState(control.GameStateManager.State.PLAY_STATE);
 			}
+		}else{										//Screen for selecting song
+			if(e.getButton().getButtonID() == 1){
+				subscreen = true;
+			}else if(e.getButton().getButtonID() == 2){
+				subscreen = false;
+			}	
 		}
 	}
 	@Override
@@ -72,26 +201,35 @@ public class MenuState extends GameState {
 	}
 	@Override
 	public void onJoystickMoved(JoystickEvent e) {
-		if(e.getJoystick().getPos() == Joystick.Position.DOWN){
-			selected++;
-			selected %= buttons.size();
-			for(int i = 0; i < buttons.size(); i++){
-				if(selected == i){
-					buttons.get(i).setSelected(true);
-				}else{
-					buttons.get(i).setSelected(false);
+		
+		if(subscreen){		
+			if(e.getJoystick().getPos() == Joystick.Position.DOWN){
+				difSelect--;
+				if(difSelect < 0){
+					difSelect += buttons2.size();
 				}
-			}
-		}else if(e.getJoystick().getPos() == Joystick.Position.UP){
-			selected--;
-			if(selected < 0) selected = buttons.size()-1;
-			for(int i = 0; i < buttons.size(); i++){
-				if(selected == i){
-					buttons.get(i).setSelected(true);
-				}else{
-					buttons.get(i).setSelected(false);
+//				System.out.println(difSelect);
+			}else if(e.getJoystick().getPos() == Joystick.Position.UP){
+				difSelect++;
+				if(difSelect > buttons2.size()-1){
+					difSelect = 0;
 				}
+				
+//				System.out.println(difSelect);
+			}
+			sh.set(sh.getCurrentSong().getSongs().get(difSelect));	
+			
+			
+			
+			
+		}else{										//Screen for selecting song
+			if(e.getJoystick().getPos() == Joystick.Position.DOWN){
+				selected++;
+			}else if(e.getJoystick().getPos() == Joystick.Position.UP){
+				selected--;
 			}
+			sh.set(songs.indexOf(selectedToSong(selected)));
+			sh.play();	
 		}
 	}
 	
@@ -107,4 +245,28 @@ public class MenuState extends GameState {
 		}
 	}
 
+	public void nextScreen(){
+		if(buttons.get(0).getX() > -700){
+			for(MenuButton b:buttons){
+				b.setX(b.getX()-100);
+			}
+		}
+	}
+	
+	public void previousScreen(){
+		if(buttons.get(0).getX() < 300){
+			for(MenuButton b:buttons){
+				b.setX(b.getX()+100);
+			}
+		}
+	}
+	
+	public Song selectedToSong(int s){
+		s %= songs.size();
+		if(s < 0){
+			return songs.get(songs.size()+s);
+		}else{
+			return songs.get(s);
+		}
+	}
 }

+ 0 - 56
model/gameState/PickSongState.java

@@ -1,56 +0,0 @@
-package model.gameState;
-
-import java.awt.Graphics2D;
-
-import model.SongHandler;
-import control.GameStateManager;
-import control.button.ButtonEvent;
-import control.joystick.JoystickEvent;
-
-public class PickSongState extends GameState {
-	
-	public PickSongState(GameStateManager gsm, SongHandler sh) {
-		super(gsm, sh);
-	}
-
-	@Override
-	public void init() {
-		sh.set(0);
-		sh.play(true);
-	}
-
-	@Override
-	public void update(float factor) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	public void draw(Graphics2D g2d) {
-		g2d.drawImage(sh.getCurrentSong().getBackgroundImage(), null, 0, 0);
-		g2d.drawImage(sh.getCurrentSong().getBannerImage(), null, 400, 0);
-	}
-
-	@Override
-	public void buttonPressed(ButtonEvent e) {}
-
-	@Override
-	public void buttonReleased(ButtonEvent e) {}
-
-	@Override
-	public void onJoystickMoved(JoystickEvent e) {
-		switch (e.getJoystick().getPos()) {
-		case LEFT:
-			sh.previous();
-			sh.play(true);
-			break;
-		case RIGHT:
-			sh.next();
-			sh.play(true);
-			break;
-		default:
-			break;
-		}
-	}
-
-}

+ 6 - 0
model/gameState/PlayState.java

@@ -51,6 +51,12 @@ public class PlayState extends GameState {
 
 	@Override
 	public void init() {
+		try {
+			Thread.sleep(2000);
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+		}
+		
 		sh.play();
 
 		for(int i=1; i<ButtonHandler.getButtons().size(); i++)

+ 35 - 16
model/gameState/TitleState.java

@@ -5,6 +5,7 @@ import image.Images.ImageType;
 
 import java.awt.Color;
 import java.awt.Font;
+import java.awt.GradientPaint;
 import java.awt.Graphics2D;
 import java.awt.image.BufferedImage;
 
@@ -22,8 +23,7 @@ public class TitleState extends GameState {
     
     int index = 0;
     int varx = 0;
-    int frame = 0;
-    int maxFrames = 2560;
+    int frame;
 
 	public TitleState(GameStateManager gsm, SongHandler sh){
 		super(gsm, sh);
@@ -43,30 +43,49 @@ public class TitleState extends GameState {
 	@Override
 	public void draw(Graphics2D g2) {
 		
-		g2.setColor(Color.WHITE);
+		
+		g2.setColor(new Color(1,1,1, 0.3f));
 		g2.fillRect(0,0,1280,1024);
 		
+		g2.setColor(new Color(0,1,0, 0.7f));
+		g2.fillRect(0,0,100,1024);
+		
+		g2.setColor(new Color(1,1,0, 0.7f));
+		g2.fillRect(100,0,100,1024);
+		
+		g2.setColor(new Color(1,0,0, 0.7f));
+		g2.fillRect(200,0,100,1024);
+		
+		g2.setColor(new Color(0,1,0, 0.7f));
+		g2.fillRect(1180,0,100,1024);
+		
+		g2.setColor(new Color(1,1,0, 0.7f));
+		g2.fillRect(1080,0,100,1024);
+		
+		g2.setColor(new Color(1,0,0, 0.7f));
+		g2.fillRect(980,0,100,1024);
+		
+		GradientPaint gp = new GradientPaint(300, 0, new Color(0,0,1, 0.6f),980,1024 ,new Color(0,0,1, 0.2f));
+		g2.setPaint(gp);
+		g2.fillRect(300, 0, 680, 1024);
+		
 		g2.translate(640, 512);
-	    
-		BufferedImage subImg2 = background.getSubimage(0, 0, 5120, 1024);
-	    g2.drawImage(subImg2, -640 -((frame * 4) % maxFrames), -512, 5120, 1024, null);
-//		
-//		g2.setColor(Color.ORANGE);
-//		g2.fillRect( -25*5 -1, - 18*5 -1, 49*5 + 1, 26*5 + 1);
-//		g2.drawRect( -25*5 -3, - 18*5 -3, 49*5 + 4, 26*5 + 4);
-
+		
 		int image_x = ((frame / 6) % 6) * 49;
 	    BufferedImage subImg = pressStart.getSubimage(image_x, 0, 49, 26);
-	    g2.drawImage(subImg, - 25*5, - 18*5, 49*5, 26*5, null);
-	    
-	    g2.drawImage(colorStrike, -27*8 , -300, 54*8, 18*8, null);
-
+	    g2.drawImage(subImg, - 25*5, 200, 49*5, 26*5, null);
 	
 		Font textFont = new Font("OCR A Extended", Font.BOLD, 15);
 		g2.setFont(textFont);
 		g2.setColor(Color.WHITE);
 		g2.drawString("�2015 Team Hamtaro", - 18*5, 500);
 		
+		g2.setColor(Color.RED);
+		Font textFont2 = new Font("OCR A Extended", Font.BOLD, 130);
+		g2.setFont(textFont2);
+		g2.drawString("Color", -215, -300);
+		g2.drawString("Strike", -250, -170);
+		
 	}
 	
 	@Override
@@ -75,7 +94,7 @@ public class TitleState extends GameState {
 		switch(e.getButton().getButtonID()){
 		case 0:
 			//gsm.next();
-			gsm.setState(State.PLAY_STATE);
+			gsm.setState(State.MENU_STATE);
 			break;
 		}
 		

+ 36 - 0
model/objects/DifficultyButton.java

@@ -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);
+		
+	}
+	
+}

+ 17 - 8
model/objects/MenuButton.java

@@ -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;
+	}
 }

BIN
songs/Card_Captor_Sakura-_Catch_You_Catch_Me/CCSIntro.mp3


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Card_Captor_Sakura-_Catch_You_Catch_Me/Card_Captor_Sakura-_Catch_You_Catch_Me.csf


BIN
songs/Card_Captor_Sakura-_Catch_You_Catch_Me/SakuraBG.png


BIN
songs/Card_Captor_Sakura-_Catch_You_Catch_Me/SakuraLogo.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Chobits-_Let_Me_Be_With_You/Chobits-_Let_Me_Be_With_You.csf


BIN
songs/Chobits-_Let_Me_Be_With_You/ChobitsIntro.mp3


BIN
songs/Chobits-_Let_Me_Be_With_You/Chobitsbg1.png


BIN
songs/Chobits-_Let_Me_Be_With_You/Chobitslogo.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Excel_Saga-_Excel's_Theme/Excel_Saga-_Excel's_Theme.csf


BIN
songs/Excel_Saga-_Excel's_Theme/excel-bg.png


BIN
songs/Excel_Saga-_Excel's_Theme/excel-logo.png


BIN
songs/Excel_Saga-_Excel's_Theme/excel.mp3


BIN
songs/Hand_Maid_May-_Jump_Meippai_Dakishimete!/HandMaidMayIntro.mp3


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Hand_Maid_May-_Jump_Meippai_Dakishimete!/Hand_Maid_May-_Jump_Meippai_Dakishimete!.csf


BIN
songs/Hand_Maid_May-_Jump_Meippai_Dakishimete!/MayBG.png


BIN
songs/Hand_Maid_May-_Jump_Meippai_Dakishimete!/MayLogo.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Love_Hina-_Sakura_Saku/Love_Hina-_Sakura_Saku.csf


BIN
songs/Love_Hina-_Sakura_Saku/sakurasaku-bg.png


BIN
songs/Love_Hina-_Sakura_Saku/sakurasaku.mp3


BIN
songs/Love_Hina-_Sakura_Saku/sakurasakulogo.png


BIN
songs/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix]/LoveHinaBG.png


BIN
songs/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix]/LoveHinaLogo.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix]/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix].csf


BIN
songs/Love_Hina-_Sakura_Saku_[Euro_Beat_Mix]/SakuraSaku.mp3


BIN
songs/Love_Hina_Again-_Kirari_Takaramono/LoveHinaAgain.mp3


BIN
songs/Love_Hina_Again-_Kirari_Takaramono/LoveHinaAgainBG.png


BIN
songs/Love_Hina_Again-_Kirari_Takaramono/LoveHinaAgainLogo.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Love_Hina_Again-_Kirari_Takaramono/Love_Hina_Again-_Kirari_Takaramono.csf


BIN
songs/Mahoromatic-_Mahoro_De_Mambo/Mahoro.mp3


BIN
songs/Mahoromatic-_Mahoro_De_Mambo/MahoroBG.png


BIN
songs/Mahoromatic-_Mahoro_De_Mambo/MahoroLogo.png


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Mahoromatic-_Mahoro_De_Mambo/Mahoromatic-_Mahoro_De_Mambo.csf


+ 0 - 72
songs/NAME_OF_SONG/NAME_OF_SONG.csf

@@ -1,72 +0,0 @@
-{
-	"meta": {
-		"title": "title of song",
-		"subtitle": "subtitle of song",
-		"author": "author of song",
-		"sample_start": 12.00,
-		"BPM": 0
-	},
-	"file": {
-		"audio": "NAME_OF_SONG.mp3",
-		"background": "background.png",
-		"banner": "banner.png"
-	},
-	"data": [
-		{
-			"difficulty": "easy",
-			"objects": [
-				{ 
-					"time": 1,
-					"direction": 1,
-					"button": 0,
-					"hold": true,
-					"length": 1000 
-				},
-				{
-					"time": 16,
-					"direction": 6,
-					"button": 1
-				}
-			],
-			"button": [
-				{
-					"time": 0,
-					"button": 0,
-					"color": 0
-				},
-				{
-					"time": 20,
-					"button": 6,
-					"color": 1
-				}
-			]
-		},
-		{
-			"difficulty": "medium",
-			"objects": [
-				{
-					"time": 4,
-					"direction": 3,
-					"button": 3
-				},
-				{
-					"time": 12,
-					"direction": 5,
-					"button": 2
-				}
-			],
-			"button": [
-				{
-					"time": 0,
-					"button": 0,
-					"color": 0
-				},
-				{
-					"time": 20,
-					"button": 6,
-					"color": 1
-				}
-			]
-		}
-	]
-}

BIN
songs/NAME_OF_SONG/NAME_OF_SONG.mp3


BIN
songs/NAME_OF_SONG/background.png


BIN
songs/NAME_OF_SONG/banner.png


BIN
songs/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix]/EvaBG.png


BIN
songs/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix]/EvaLogo.png


BIN
songs/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix]/Evangelion.mp3


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix]/Neon_Genesis_Evangelion-_Cruel_Angel's_Thesis_[Euro_Mix].csf


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit)/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit).csf


BIN
songs/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit)/freckles.mp3


BIN
songs/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit)/rk-bg.png


BIN
songs/Rurouni_Kenshin-_Freckles_(KCP_Re-Edit)/rk-logo.png


+ 0 - 72
songs/SECOND_SONG/NAME_OF_SONG.csf

@@ -1,72 +0,0 @@
-{
-	"meta": {
-		"title": "Song #2",
-		"subtitle": "Some song",
-		"author": "Kenneth",
-		"sample_start": 136.000,
-		"BPM": 44.260
-	},
-	"file": {
-		"audio": "NAME_OF_SONG.mp3",
-		"background": "background.png",
-		"banner": "banner.png"
-	},
-	"data": [
-		{
-			"difficulty": "easy",
-			"objects": [
-				{ 
-					"time": 1,
-					"direction": 1,
-					"button": 0,
-					"hold": true,
-					"length": 1000 
-				},
-				{
-					"time": 16,
-					"direction": 6,
-					"button": 1
-				}
-			],
-			"button": [
-				{
-					"time": 0,
-					"button": 0,
-					"color": 0
-				},
-				{
-					"time": 20,
-					"button": 6,
-					"color": 1
-				}
-			]
-		},
-		{
-			"difficulty": "medium",
-			"objects": [
-				{
-					"time": 4,
-					"direction": 3,
-					"button": 3
-				},
-				{
-					"time": 12,
-					"direction": 5,
-					"button": 2
-				}
-			],
-			"button": [
-				{
-					"time": 0,
-					"button": 0,
-					"color": 0
-				},
-				{
-					"time": 20,
-					"button": 6,
-					"color": 1
-				}
-			]
-		}
-	]
-}

BIN
songs/SECOND_SONG/NAME_OF_SONG.mp3


BIN
songs/SECOND_SONG/background.png


BIN
songs/SECOND_SONG/banner.png


BIN
songs/Sister_Princess-_Love_Destiny/SPBg1.png


BIN
songs/Sister_Princess-_Love_Destiny/SPLogo.png


BIN
songs/Sister_Princess-_Love_Destiny/SisterPrincessIntro.mp3


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Sister_Princess-_Love_Destiny/Sister_Princess-_Love_Destiny.csf


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Slayers-_Midnight_Blue/Slayers-_Midnight_Blue.csf


BIN
songs/Slayers-_Midnight_Blue/SlayersLogo.png


BIN
songs/Slayers-_Midnight_Blue/SlayersMovieTheme.mp3


BIN
songs/Slayers-_Midnight_Blue/Slayersbg.PNG


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 0 - 0
songs/Vandread-_Trust/Vandread-_Trust.csf


BIN
songs/Vandread-_Trust/VandreadBG1.png


BIN
songs/Vandread-_Trust/VandreadIntro.mp3


BIN
songs/Vandread-_Trust/VandreadLogo.png


+ 2 - 0
view/GameView.java

@@ -4,6 +4,7 @@ import java.awt.Dimension;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.RenderingHints;
+import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
@@ -43,5 +44,6 @@ public class GameView extends JPanel{
 	              RenderingHints.VALUE_ANTIALIAS_ON);
 	     g2d.setRenderingHints(rh);
 		gsm.currentState.draw(g2d);		
+		Toolkit.getDefaultToolkit().sync();
 	}	
 }

Một số tệp đã không được hiển thị bởi vì quá nhiều tập tin thay đổi trong này khác