diff options
| -rw-r--r-- | src/fallTest/LaneInfo.java | 27 | ||||
| -rw-r--r-- | src/fallTest/NoteNode.java | 1 | ||||
| -rw-r--r-- | src/fallTest/newSongPlayer.java | 97 | 
3 files changed, 66 insertions, 59 deletions
| diff --git a/src/fallTest/LaneInfo.java b/src/fallTest/LaneInfo.java new file mode 100644 index 0000000..5eef143 --- /dev/null +++ b/src/fallTest/LaneInfo.java @@ -0,0 +1,27 @@ +package fallTest;
 +
 +import java.util.ArrayList;
 +import java.util.LinkedList;
 +import java.util.Queue;
 +
 +import javax.swing.JButton;
 +
 +public class LaneInfo {
 +    Queue<NoteInfo> sends = new LinkedList<NoteInfo>();         //Queue that dictates when to send the notes
 +    ArrayList<Block> nodes = new ArrayList<Block>();       //Array list containing all the notes currently on the field
 +    public void addSends(int t) {
 +    	sends.add(new NoteInfo(t));
 +    }
 +    
 +    public void addNodes(int t) {
 +    	nodes.add(new Block());
 +    }
 +    
 +    public ArrayList<Block> getNodes() {
 +    	return nodes;
 +    }
 +    
 +    public Queue<NoteInfo> getSends() {
 +    	return sends;
 +    }
 +}
 diff --git a/src/fallTest/NoteNode.java b/src/fallTest/NoteNode.java index c24e10f..3a29142 100644 --- a/src/fallTest/NoteNode.java +++ b/src/fallTest/NoteNode.java @@ -4,6 +4,7 @@ import javafx.animation.*;  import javafx.util.Duration;
  public class NoteNode {
 +	private final int TIME = 20;
  	private NoteField info;
  	private Block vis;
  	TranslateTransition anim = new TranslateTransition(Duration.millis(TIME));
 diff --git a/src/fallTest/newSongPlayer.java b/src/fallTest/newSongPlayer.java index ff96d63..f9affad 100644 --- a/src/fallTest/newSongPlayer.java +++ b/src/fallTest/newSongPlayer.java @@ -3,6 +3,9 @@ package fallTest;  import javafx.event.EventHandler;
  import java.awt.Insets;
 +import java.util.ArrayList;
 +import java.util.LinkedList;
 +import java.util.Queue;
  import javafx.event.*;
  import javafx.event.ActionEvent;
 @@ -27,96 +30,54 @@ import javafx.scene.text.Text;  public class newSongPlayer extends Pane
  {
 +    Timer time = new Timer();
 +    
 +    private double dLaneX;
 +
 +    
  	public void init() {
 +	    Queue<NoteInfo> dSends = new LinkedList<NoteInfo>();         //Queue that dictates when to send the notes
 +	    ArrayList<Block> dLane = new ArrayList<Block>();     //Array list containing all the notes currently on the field
 +	    
  		Rectangle field = new Rectangle(50, 50, new Color(0, 0, 0, 0.7));
  		field.heightProperty().bind(this.getScene().getWindow().heightProperty().multiply(0.95));
 -		field.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(2.).add(50));
 -		
 +		field.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(2.7).add(50));
  		TButton dButton = new TButton(Color.RED, 50, 50, 5);
 -		dButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		dButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		dButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		dButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		dButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210));
 -		//Text dButtonText = new Text("D");
 -		dButton.setOnKeyPressed(e -> { 
 +		genButton(dButton);
 +		/*dButton.setOnKeyPressed(e -> { 
  			if (e.getCode() == KeyCode.D) {
  				System.out.println("D");
  			}
 -		});
 +		});*/
  		TButton fButton = new TButton(Color.BLUE, 50, 50, 5);
 -		fButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		fButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		fButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		fButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		fButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210));
 -		fButton.setOnKeyPressed(e -> { 
 -			if (e.getCode() == KeyCode.F) {
 -				System.out.println("F");
 -			}
 -		});
 +		genButton(fButton);
  		TButton sButton = new TButton(Color.GREEN, 50, 50, 5);
 -		sButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		sButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		sButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		sButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		sButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210));
 -		sButton.setOnKeyPressed(e -> { 
 -			if (e.getCode() == KeyCode.SPACE) {
 -				System.out.println("SPC");
 -			}
 -		});
 +		genButton(sButton);
  		TButton jButton = new TButton(Color.PURPLE, 50, 50, 5);
 -		jButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		jButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		jButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		jButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		jButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210));
 -		jButton.setOnKeyPressed(e -> { 
 -			if (e.getCode() == KeyCode.J) {
 -				System.out.println("J");
 -			}
 -		});
 +		genButton(jButton);
  		TButton kButton = new TButton(Color.YELLOW, 50, 50, 5);
 -		kButton.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		kButton.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(12));
 -		kButton.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		kButton.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 -		kButton.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210));
 -		kButton.setOnKeyPressed(e -> { 
 -			if (e.getCode() == KeyCode.K) {
 -				System.out.println("K");
 -			}
 -		});
 -		
 -		//StackPane dButtonComplete = new StackPane();
 -		//dButtonComplete.getChildren().addAll(dButtonText, dButton);
 +		genButton(kButton);
 +
  		HBox buttonBox = new HBox();
 -		
  		buttonBox.setStyle("-fx-padding: 0;" + "-fx-border-style: solid inside;"
  		        + "-fx-border-width: 0;" + "-fx-border-insets: 20;"
 -		        + "-fx-border-radius: 0;" + "-fx-border-color: black;"
  		        + "-fx-background-color: black;" + "-fx-opacity: 0.67;");
  		buttonBox.setAlignment(Pos.CENTER);
  	    buttonBox.getChildren().addAll(dButton, fButton, sButton, jButton, kButton);
  	    buttonBox.setSpacing(10);
  	    VBox polish = new VBox();
 -	    polish.prefHeightProperty().bind(this.getScene().heightProperty());
  	    polish.getChildren().addAll(field);
  	    polish.setAlignment(Pos.TOP_CENTER);
  	    VBox place = new VBox();
  		place.prefWidthProperty().bind(this.getScene().widthProperty());
  		place.prefHeightProperty().bind(this.getScene().heightProperty());
 -	    //root.setStyle("-fx-padding: 0;" + "-fx-border-style: solid inside;"
 -		//        + "-fx-border-width: 2;" + "-fx-border-insets: 0;"
 -		//        + "-fx-border-radius: 2;" + "-fx-border-color: red;");
  	    place.setAlignment(Pos.BOTTOM_CENTER);
  	    place.getChildren().addAll(buttonBox);
  	    place.setSpacing(10);
 @@ -126,5 +87,23 @@ public class newSongPlayer extends Pane          super.getChildren().add(root);
 +	    sendNote(dLane);
 +	}
 +	
 +	public void sendNote(ArrayList<Block> lane) {
 +		lane.add(new Block(Color.PINK, 50, 50, 5));
 +		lane.get(lane.size()-1).heightProperty().bind(this.getScene().getWindow().widthProperty().divide(16));
 +		lane.get(lane.size()-1).widthProperty().bind(this.getScene().getWindow().widthProperty().divide(16));
 +		lane.get(lane.size()-1).arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 +		lane.get(lane.size()-1).arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 +		super.getChildren().add(lane.get(lane.size()-1));
 +	}
 +	
 +	public void genButton(TButton button) {
 +		button.heightProperty().bind(this.getScene().getWindow().widthProperty().divide(16));
 +		button.widthProperty().bind(this.getScene().getWindow().widthProperty().divide(16));
 +		button.arcHeightProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 +		button.arcWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(50));
 +		button.strokeWidthProperty().bind(this.getScene().getWindow().widthProperty().divide(210));
  	}
  }
 | 
