aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorsowgro <tpoke.ferrari@gmail.com>2023-05-23 00:39:57 -0400
committersowgro <tpoke.ferrari@gmail.com>2023-05-23 00:39:57 -0400
commit005c645b3cd991079dfd9bac2f207cdd2068d161 (patch)
treeed82f11d248a1a0e08ea0ed82380913250a0f278 /src/main
parentf941b529f1cb12312041516e6799ece0f6df2cac (diff)
downloadNPEhero-005c645b3cd991079dfd9bac2f207cdd2068d161.tar.gz
NPEhero-005c645b3cd991079dfd9bac2f207cdd2068d161.tar.bz2
NPEhero-005c645b3cd991079dfd9bac2f207cdd2068d161.zip
finish gui, add new leaderboard system, redesign settings, switch lists to tables
Diffstat (limited to 'src/main')
-rw-r--r--src/main/Difficulty.java19
-rw-r--r--src/main/LeaderboardController.java5
-rw-r--r--src/main/LeaderboardEntry.java33
-rw-r--r--src/main/Level.java37
-rw-r--r--src/main/LevelController.java42
-rw-r--r--src/main/SettingsController.java10
6 files changed, 113 insertions, 33 deletions
diff --git a/src/main/Difficulty.java b/src/main/Difficulty.java
new file mode 100644
index 0000000..2d2b5c3
--- /dev/null
+++ b/src/main/Difficulty.java
@@ -0,0 +1,19 @@
+package main;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import javafx.collections.FXCollections;
+import javafx.collections.ObservableList;
+
+public class Difficulty
+{
+ public String title;
+ public ObservableList<LeaderboardEntry> leaderboard = FXCollections.observableArrayList();
+ public File notes;
+
+ public String toString()
+ {
+ return title;
+ }
+}
diff --git a/src/main/LeaderboardController.java b/src/main/LeaderboardController.java
deleted file mode 100644
index b48f103..0000000
--- a/src/main/LeaderboardController.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package main;
-
-public class LeaderboardController {
-
-}
diff --git a/src/main/LeaderboardEntry.java b/src/main/LeaderboardEntry.java
new file mode 100644
index 0000000..61a0449
--- /dev/null
+++ b/src/main/LeaderboardEntry.java
@@ -0,0 +1,33 @@
+package main;
+
+import javafx.beans.property.SimpleIntegerProperty;
+import javafx.beans.property.SimpleStringProperty;
+
+public class LeaderboardEntry
+{
+ private SimpleIntegerProperty score;
+ private SimpleStringProperty name;
+
+ //all below is required for table view
+ public LeaderboardEntry(String name, int score)
+ {
+ this.name = new SimpleStringProperty(name);
+ this.score = new SimpleIntegerProperty(score);
+ }
+
+ public int getScore() {
+ return score.get();
+ }
+
+ public void setScore(int score) {
+ this.score.set(score);
+ }
+
+ public String getName() {
+ return name.get();
+ }
+
+ public void setName(String name) {
+ this.name.set(name);
+ }
+}
diff --git a/src/main/Level.java b/src/main/Level.java
index 71560d2..d492c88 100644
--- a/src/main/Level.java
+++ b/src/main/Level.java
@@ -3,27 +3,46 @@ package main;
import java.io.File;
import java.util.ArrayList;
+import javafx.beans.property.SimpleStringProperty;
import javafx.scene.image.Image;
import javafx.scene.paint.Color;
public class Level
{
- public Image preview;
- public String title;
- public String aritst;
+ public Image preview; //optional
+ private SimpleStringProperty title;
+ private SimpleStringProperty artist;
public String desc;
- public ArrayList<String> diffList = new ArrayList<String>();
+ public ArrayList<Difficulty> diffList = new ArrayList<Difficulty>();
- public Image background;
- public Color[] colors;
+ public Image background; //optional
+ public Color[] colors; //optional, have default colors
- public void setColors(Color... newColors)
+ public void setColors(Color... newColors)
{
colors = newColors;
}
- public String toString()
+ //all below is required for table view
+ public Level(String title, String artist)
{
- return title+" - "+aritst;
+ this.title = new SimpleStringProperty(title);
+ this.artist = new SimpleStringProperty(artist);
+ }
+
+ public String getTitle() {
+ return title.get();
+ }
+
+ public String getArtist() {
+ return artist.get();
+ }
+
+ public void setTitle(String title) {
+ this.title.set(title);
+ }
+
+ public void setArtist(String artist) {
+ this.artist.set(artist);
}
}
diff --git a/src/main/LevelController.java b/src/main/LevelController.java
index 6d2f5dc..f2199cf 100644
--- a/src/main/LevelController.java
+++ b/src/main/LevelController.java
@@ -1,7 +1,5 @@
package main;
-import java.util.ArrayList;
-
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.image.Image;
@@ -13,25 +11,39 @@ public class LevelController
public LevelController()
{
- Level testLevel = new Level();
- testLevel.title = "test level class";
+ Difficulty d1 = new Difficulty();
+ d1.title = "Easy";
+ LeaderboardEntry lb = new LeaderboardEntry("t-bone", 1000);
+ //lb.setName("t-bone");
+ //lb.setScore(1000);
+ d1.leaderboard.add(lb);
+
+ Difficulty d2 = new Difficulty();
+ d2.title = "Medium";
+ Difficulty d3 = new Difficulty();
+ d3.title = "Hard";
+ Difficulty d4 = new Difficulty();
+ d4.title = "Expert";
+ Difficulty d5 = new Difficulty();
+ d5.title = "Impossible";
+
+ Level testLevel = new Level("test level class","testArtist");
+ //testLevel.setTitle("test level class");
testLevel.desc = "this level is being used to test the LevelController class";
- testLevel.aritst = "testArtist";
+ //testLevel.setAritst("testArtist");
testLevel.setColors(Color.RED, Color.BLUE, Color.GREEN, Color.ORANGE, Color.PURPLE);
- testLevel.diffList.add("Hello");
- testLevel.diffList.add("Easy");
- testLevel.diffList.add("Med");
+ testLevel.diffList.add(d1);
+ testLevel.diffList.add(d2);
levelList.add(testLevel);
- Level testLevel2 = new Level();
- testLevel2.title = "another one";
+ Level testLevel2 = new Level("another one", "testArtist2");
+ //testLevel2.setTitle("another one");
testLevel2.desc = "it can say something else too";
- testLevel2.aritst = "testArtist2";
+ //testLevel2.setAritst("testArtist2");
testLevel2.setColors(Color.RED, Color.BLUE, Color.GREEN, Color.ORANGE, Color.PURPLE);
- testLevel2.diffList.add("Hard");
- testLevel2.diffList.add("Easy");
- testLevel2.diffList.add("Med");
- testLevel2.diffList.add("insane+++");
+ testLevel2.diffList.add(d2);
+ testLevel2.diffList.add(d3);
+ testLevel2.diffList.add(d4);
testLevel2.preview = new Image("assets/pico.png");
levelList.add(testLevel2);
diff --git a/src/main/SettingsController.java b/src/main/SettingsController.java
index f767570..2e2d988 100644
--- a/src/main/SettingsController.java
+++ b/src/main/SettingsController.java
@@ -12,10 +12,12 @@ import org.json.simple.JSONArray;
import org.json.simple.parser.JSONParser;
import org.json.simple.parser.ParseException;
+import javafx.beans.property.SimpleIntegerProperty;
+
public class SettingsController
{
- private int effectsVol;
- private int musicVol;
+ public SimpleIntegerProperty effectsVol = new SimpleIntegerProperty(0);
+ public SimpleIntegerProperty musicVol = new SimpleIntegerProperty(0);
private boolean fullscreen;
private JSONObject settings;
@@ -34,8 +36,8 @@ public class SettingsController
settings = (JSONObject)(obj); //converts read object to a JSONObject
- effectsVol = (int) settings.get("effectsVol");
- musicVol = (int) settings.get("musicVol");
+ effectsVol.set((int) settings.get("effectsVol"));
+ musicVol.set((int) settings.get("musicVol"));
fullscreen = (boolean) settings.get("fullscreen");
}
catch (FileNotFoundException e)