aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-06-02 01:31:49 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-06-02 01:31:49 -0400
commit0b7f45fcb05814870733613dcff233451948c967 (patch)
treea18044aa13d3374d39177332b57a822f32c60843 /src
parent4e43d6f020d908ccd9b8a6b77803cac943da00ed (diff)
downloadNPEhero-0b7f45fcb05814870733613dcff233451948c967.tar.gz
NPEhero-0b7f45fcb05814870733613dcff233451948c967.tar.bz2
NPEhero-0b7f45fcb05814870733613dcff233451948c967.zip
start note editor, new test level
Diffstat (limited to 'src')
-rw-r--r--src/devmenu/NotesEditor.java25
-rw-r--r--src/main/Difficulty.java4
-rw-r--r--src/main/Level.java4
3 files changed, 23 insertions, 10 deletions
diff --git a/src/devmenu/NotesEditor.java b/src/devmenu/NotesEditor.java
index 400d547..41bc1c3 100644
--- a/src/devmenu/NotesEditor.java
+++ b/src/devmenu/NotesEditor.java
@@ -5,6 +5,10 @@ import gameplay.Timer;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.HBox;
+import javafx.scene.layout.VBox;
+import javafx.scene.media.Media;
+import javafx.scene.media.MediaPlayer;
+import javafx.scene.media.MediaView;
import javafx.scene.text.Text;
import javafx.stage.Stage;
import main.Difficulty;
@@ -12,23 +16,29 @@ import sound.AudioFilePlayer;
public class NotesEditor
{
+ MediaPlayer mediaPlayer;
Difficulty diff;
AudioFilePlayer music;
Timer timer;
public NotesEditor(Difficulty diff)
{
this.diff = diff;
-
- Text timerDisplay = new Text("TIMER");
Button start = new Button("Start");
start.setOnAction(e -> start());
- Button stop = new Button("Stop");
+ Button stop = new Button("Pause");
stop.setOnAction(e -> stop());
- HBox main = new HBox();
- main.getChildren().addAll(timerDisplay,start,stop);
+ Button print = new Button("print");
+ print.setOnAction(e -> System.out.println(timer.time()));
+
+ Media song = new Media(diff.level.song.toURI().toString());
+ mediaPlayer = new MediaPlayer(song);
+ new MediaView(mediaPlayer);
+
+ VBox main = new VBox();
+ main.getChildren().addAll(start,stop,print);
Scene scene = new Scene(main);
Stage primaryStage = new Stage();
@@ -38,12 +48,13 @@ public class NotesEditor
private void start()
{
- music = new AudioFilePlayer(new File(diff.thisDir, "song.wav").toPath().toString());
+ mediaPlayer.play();
+
timer = new Timer(diff.bpm);
}
private void stop()
{
-
+ mediaPlayer.pause();
}
} \ No newline at end of file
diff --git a/src/main/Difficulty.java b/src/main/Difficulty.java
index 18dabb3..c7a289a 100644
--- a/src/main/Difficulty.java
+++ b/src/main/Difficulty.java
@@ -19,14 +19,16 @@ public class Difficulty
public File notes;
public int bpm;
public int numBeats;
+ public Level level;
/**
* Creates a new Difficulty and gives it a file path
* @param newDir: The file path of the Difficulty
*/
- public Difficulty(File newDir)
+ public Difficulty(File newDir, Level level)
{
thisDir = newDir;
+ this.level = level;
}
/**
diff --git a/src/main/Level.java b/src/main/Level.java
index 591bd9a..cb16489 100644
--- a/src/main/Level.java
+++ b/src/main/Level.java
@@ -46,7 +46,7 @@ public class Level
{
if (cur.isDirectory()) //all subfolders within a level folder are difficulties
{
- Difficulty diff = new Difficulty(cur);
+ Difficulty diff = new Difficulty(cur,this);
diff.readData();
diffList.add(diff);
}
@@ -151,7 +151,7 @@ public class Level
} catch (IOException e) {
e.printStackTrace();
}
- Difficulty temp = new Difficulty(diffDir);
+ Difficulty temp = new Difficulty(diffDir,this);
temp.title = text;
temp.writeMetadata();
temp.writeLeaderboard();