diff --git a/ShootingStars/assets/Gui/Scrolling/Scrolling.gui.xml b/ShootingStars/assets/Gui/Scrolling/Scrolling.gui.xml
index e8791cf..cca4ba5 100644
--- a/ShootingStars/assets/Gui/Scrolling/Scrolling.gui.xml
+++ b/ShootingStars/assets/Gui/Scrolling/Scrolling.gui.xml
@@ -28,7 +28,7 @@
-
+
@@ -62,11 +62,12 @@
+
-
-
+
+
diff --git a/ShootingStars/assets/Gui/Scrolling/thumb.png b/ShootingStars/assets/Gui/Scrolling/thumb.png
new file mode 100644
index 0000000..1775330
Binary files /dev/null and b/ShootingStars/assets/Gui/Scrolling/thumb.png differ
diff --git a/ShootingStars/assets/Gui/Scrolling/thumbHover.png b/ShootingStars/assets/Gui/Scrolling/thumbHover.png
new file mode 100644
index 0000000..6db2da7
Binary files /dev/null and b/ShootingStars/assets/Gui/Scrolling/thumbHover.png differ
diff --git a/ShootingStars/assets/Gui/Table/Table.gui.xml b/ShootingStars/assets/Gui/Table/Table.gui.xml
new file mode 100644
index 0000000..80c227c
--- /dev/null
+++ b/ShootingStars/assets/Gui/Table/Table.gui.xml
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ShootingStars/assets/Gui/Window/panel_x.png b/ShootingStars/assets/Gui/Window/panel_x.png
index 435db20..5d813f8 100644
Binary files a/ShootingStars/assets/Gui/Window/panel_x.png and b/ShootingStars/assets/Gui/Window/panel_x.png differ
diff --git a/ShootingStars/assets/Gui/Window/panel_x_inner.png b/ShootingStars/assets/Gui/Window/panel_x_inner.png
deleted file mode 100644
index 435db20..0000000
Binary files a/ShootingStars/assets/Gui/Window/panel_x_inner.png and /dev/null differ
diff --git a/ShootingStars/assets/Gui/style_map.gui.xml b/ShootingStars/assets/Gui/style_map.gui.xml
index 1a8adaf..2f312d3 100644
--- a/ShootingStars/assets/Gui/style_map.gui.xml
+++ b/ShootingStars/assets/Gui/style_map.gui.xml
@@ -17,5 +17,6 @@
+
diff --git a/ShootingStars/bulletjme.dll b/ShootingStars/bulletjme.dll
new file mode 100644
index 0000000..d33cc15
Binary files /dev/null and b/ShootingStars/bulletjme.dll differ
diff --git a/ShootingStars/lib/tonegodgui-0.0.2.jar b/ShootingStars/lib/tonegodgui-0.0.2.jar
new file mode 100644
index 0000000..46c145b
Binary files /dev/null and b/ShootingStars/lib/tonegodgui-0.0.2.jar differ
diff --git a/ShootingStars/nbproject/desktop-deployment-impl.xml b/ShootingStars/nbproject/desktop-deployment-impl.xml
new file mode 100644
index 0000000..3526a34
--- /dev/null
+++ b/ShootingStars/nbproject/desktop-deployment-impl.xml
@@ -0,0 +1,282 @@
+
+
+
+
+
+
+ Windows 32bit Application Creation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Windows 64bit Application Creation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Linux 32bit Application Creation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Linux 64bit Application Creation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ MacOSX Application Creation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ShootingStars/nbproject/project.xml b/ShootingStars/nbproject/project.xml
index 62e7f2a..5c96d20 100644
--- a/ShootingStars/nbproject/project.xml
+++ b/ShootingStars/nbproject/project.xml
@@ -6,6 +6,9 @@
+
+
+
ShootingStars
diff --git a/ShootingStars/resources/desktop-deployment/linux-x64/package.cfg b/ShootingStars/resources/desktop-deployment/linux-x64/package.cfg
new file mode 100644
index 0000000..e7a68dd
--- /dev/null
+++ b/ShootingStars/resources/desktop-deployment/linux-x64/package.cfg
@@ -0,0 +1,6 @@
+app.mainjar=${jar.name}
+app.version=1.0
+app.preferences.id=${application.title}
+app.mainclass=${main.class}
+app.classpath=
+${launcher.jvmargs}
diff --git a/ShootingStars/resources/desktop-deployment/linux-x64/stub b/ShootingStars/resources/desktop-deployment/linux-x64/stub
new file mode 100644
index 0000000..3cc0a51
Binary files /dev/null and b/ShootingStars/resources/desktop-deployment/linux-x64/stub differ
diff --git a/ShootingStars/resources/desktop-deployment/linux-x86/package.cfg b/ShootingStars/resources/desktop-deployment/linux-x86/package.cfg
new file mode 100644
index 0000000..e7a68dd
--- /dev/null
+++ b/ShootingStars/resources/desktop-deployment/linux-x86/package.cfg
@@ -0,0 +1,6 @@
+app.mainjar=${jar.name}
+app.version=1.0
+app.preferences.id=${application.title}
+app.mainclass=${main.class}
+app.classpath=
+${launcher.jvmargs}
diff --git a/ShootingStars/resources/desktop-deployment/linux-x86/stub b/ShootingStars/resources/desktop-deployment/linux-x86/stub
new file mode 100644
index 0000000..2420ddb
Binary files /dev/null and b/ShootingStars/resources/desktop-deployment/linux-x86/stub differ
diff --git a/ShootingStars/resources/desktop-deployment/macosx-x64/Info.plist b/ShootingStars/resources/desktop-deployment/macosx-x64/Info.plist
new file mode 100644
index 0000000..005deef
--- /dev/null
+++ b/ShootingStars/resources/desktop-deployment/macosx-x64/Info.plist
@@ -0,0 +1,55 @@
+
+
+
+
+ LSMinimumSystemVersion
+ 10.7.4
+ CFBundleDevelopmentRegion
+ English
+ CFBundleAllowMixedLocalizations
+
+ CFBundleExecutable
+ JavaAppLauncher
+ CFBundleIconFile
+ GenericApp.icns
+ CFBundleIdentifier
+ ${main.class}
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ ${application.title}
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+
+ LSApplicationCategoryType
+ Unknown
+ CFBundleVersion
+ 100
+ NSHumanReadableCopyright
+ Copyright (C) 2015
+
+ JVMMainClassName
+ ${main.class}
+ JVMAppClasspath
+
+ JVMMainJarName
+ ${jar.name}
+ JVMPreferencesID
+ ${application.title}
+ JVMOptions
+
+ ${run.jvmargs}
+
+ JVMUserOptions
+
+
+
+ NSHighResolutionCapable
+ true
+
+
\ No newline at end of file
diff --git a/ShootingStars/resources/desktop-deployment/macosx-x64/icon.icns b/ShootingStars/resources/desktop-deployment/macosx-x64/icon.icns
new file mode 100644
index 0000000..04b41b3
Binary files /dev/null and b/ShootingStars/resources/desktop-deployment/macosx-x64/icon.icns differ
diff --git a/ShootingStars/resources/desktop-deployment/macosx-x64/stub b/ShootingStars/resources/desktop-deployment/macosx-x64/stub
new file mode 100644
index 0000000..8012780
Binary files /dev/null and b/ShootingStars/resources/desktop-deployment/macosx-x64/stub differ
diff --git a/ShootingStars/resources/desktop-deployment/windows-x64/icon.ico b/ShootingStars/resources/desktop-deployment/windows-x64/icon.ico
new file mode 100644
index 0000000..5ef7de6
Binary files /dev/null and b/ShootingStars/resources/desktop-deployment/windows-x64/icon.ico differ
diff --git a/ShootingStars/resources/desktop-deployment/windows-x64/package.cfg b/ShootingStars/resources/desktop-deployment/windows-x64/package.cfg
new file mode 100644
index 0000000..0384a0e
--- /dev/null
+++ b/ShootingStars/resources/desktop-deployment/windows-x64/package.cfg
@@ -0,0 +1,7 @@
+app.mainjar=${jar.name}
+app.version=1.0
+app.id=${application.title}
+app.preferences.id=${application.title}
+app.mainclass=${main.class}
+app.classpath=
+${launcher.jvmargs}
diff --git a/ShootingStars/resources/desktop-deployment/windows-x64/stub.exe b/ShootingStars/resources/desktop-deployment/windows-x64/stub.exe
new file mode 100644
index 0000000..d508de1
Binary files /dev/null and b/ShootingStars/resources/desktop-deployment/windows-x64/stub.exe differ
diff --git a/ShootingStars/resources/desktop-deployment/windows-x86/icon.ico b/ShootingStars/resources/desktop-deployment/windows-x86/icon.ico
new file mode 100644
index 0000000..5ef7de6
Binary files /dev/null and b/ShootingStars/resources/desktop-deployment/windows-x86/icon.ico differ
diff --git a/ShootingStars/resources/desktop-deployment/windows-x86/package.cfg b/ShootingStars/resources/desktop-deployment/windows-x86/package.cfg
new file mode 100644
index 0000000..0384a0e
--- /dev/null
+++ b/ShootingStars/resources/desktop-deployment/windows-x86/package.cfg
@@ -0,0 +1,7 @@
+app.mainjar=${jar.name}
+app.version=1.0
+app.id=${application.title}
+app.preferences.id=${application.title}
+app.mainclass=${main.class}
+app.classpath=
+${launcher.jvmargs}
diff --git a/ShootingStars/resources/desktop-deployment/windows-x86/stub.exe b/ShootingStars/resources/desktop-deployment/windows-x86/stub.exe
new file mode 100644
index 0000000..1843b4d
Binary files /dev/null and b/ShootingStars/resources/desktop-deployment/windows-x86/stub.exe differ
diff --git a/ShootingStars/src/org/wyrez/shootingstars/data/AudioDataManager.java b/ShootingStars/src/org/wyrez/shootingstars/data/AudioDataManager.java
index 9c1bfba..cc72140 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/data/AudioDataManager.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/data/AudioDataManager.java
@@ -34,6 +34,7 @@ public class AudioDataManager {
private static final Band LOW_BAND = new Band(1f, 140);
private static final Band MID_BAND = new Band(400f, 1200f);
private static final Band HIGH_BAND = new Band(2000f, 16000f);
+ private static final float MAX_POINTS = 100f;
/**/
private AudioProcessor audioProcessorLowBand;
private AudioProcessor audioProcessorMidBand;
@@ -140,6 +141,16 @@ public class AudioDataManager {
audioProcessorMidBand = null;
}
+ public int getMaxAchievablePoints() {
+ int maxAchievablePoints = 0;
+
+ for (int i = 0; i < spawnData.length; i++) {
+ maxAchievablePoints += (int) Math.round(MAX_POINTS * spawnData[i]);
+ }
+
+ return maxAchievablePoints;
+ }
+
public void analyseHighBand() {
audioProcessorHighBand.calculate();
@@ -243,7 +254,7 @@ public class AudioDataManager {
lastSpawnDataPollIndex = index;
return data;
}
-
+
public float getRemainingTime() {
return (player.getTime() - player.getLength()) * -1;
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/game/Ground.java b/ShootingStars/src/org/wyrez/shootingstars/game/Ground.java
index af3aaf7..83c4429 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/game/Ground.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/game/Ground.java
@@ -108,7 +108,7 @@ public class Ground extends Node {
private void addLight() {
AmbientLight ambient = new AmbientLight();
- ambient.setColor(new ColorRGBA(0.5f, 0.5f, 0.5f, 1f));
+ ambient.setColor(new ColorRGBA(0.1f, 0.1f, 0.1f, 1f));
this.addLight(ambient);
}
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/BackgroundedGui.java b/ShootingStars/src/org/wyrez/shootingstars/gui/BackgroundedGui.java
index 0e674b8..50c27b5 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/BackgroundedGui.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/BackgroundedGui.java
@@ -19,9 +19,7 @@ package org.wyrez.shootingstars.gui;
import com.jme3.asset.AssetManager;
import com.jme3.math.Vector2f;
import com.jme3.ui.Picture;
-import tonegod.gui.controls.text.Label;
import tonegod.gui.controls.windows.Panel;
-import tonegod.gui.core.Element;
import tonegod.gui.core.Screen;
/**
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/FileMetaInfoGUI.java b/ShootingStars/src/org/wyrez/shootingstars/gui/FileMetaInfoGUI.java
index 3a904ab..d46f61f 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/FileMetaInfoGUI.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/FileMetaInfoGUI.java
@@ -49,11 +49,11 @@ public class FileMetaInfoGUI extends BackgroundedGui implements Gui {
this.settings = settings;
this.screenHelper = screenHelper;
this.setIgnoreMouse(true);
- this.setIsVisible(false);
- create();
+ this.setAsContainerOnly();
}
- private void create() {
+ @Override
+ public void create() {
float startPointx = screenHelper.calcX(256f);
float startPointy = screenHelper.calcY(202f);
float marginLeft = screenHelper.calcX(110f);
@@ -120,6 +120,7 @@ public class FileMetaInfoGUI extends BackgroundedGui implements Gui {
this.addChild(btnCancel);
}
+ @Override
public void refresh() {
lblDuration.setText(String.valueOf(settings.getTrackLength()) + " s");
lblTitel.setText(settings.getTrackTitle());
@@ -127,10 +128,12 @@ public class FileMetaInfoGUI extends BackgroundedGui implements Gui {
lblFileName.setText(new File(settings.getVideoFile()).getName());
}
+ @Override
public void attach() {
screen.addElement(this);
}
+ @Override
public void detach() {
screen.removeElement(this);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/GameGUI.java b/ShootingStars/src/org/wyrez/shootingstars/gui/GameGUI.java
index d0a9013..e38aabb 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/GameGUI.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/GameGUI.java
@@ -25,7 +25,9 @@ import org.wyrez.shootingstars.gui.controls.ButtonBase;
import org.wyrez.shootingstars.gui.controls.GuiMusicRemainingTimeControl;
import org.wyrez.shootingstars.gui.controls.GuiPlayerPointsControl;
import org.wyrez.shootingstars.gui.listener.GameListener;
+import org.wyrez.shootingstars.gui.model.GameMode;
import org.wyrez.shootingstars.helper.ScreenHelper;
+import org.wyrez.shootingstars.states.util.OptionSettings;
import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.extras.Indicator;
import tonegod.gui.controls.text.Label;
@@ -36,7 +38,7 @@ import tonegod.gui.core.Screen;
*
* @author Darth Affe
*/
-public class GameGUI extends Panel implements Gui{
+public class GameGUI extends Panel implements Gui {
private GameListener listener;
private Button btnStart;
@@ -49,19 +51,23 @@ public class GameGUI extends Panel implements Gui{
private ScreenHelper screenHelper;
private AudioDataManager audioDataManager;
private Panel pointsTimePanel;
+ private GameMode gameMode;
+ private OptionSettings optionSettings;
- public GameGUI(Screen screen, GameListener listener, ScreenHelper screenHelper, AudioDataManager audioDataManager) {
+ public GameGUI(Screen screen, GameListener listener, ScreenHelper screenHelper, AudioDataManager audioDataManager, OptionSettings optionSettings) {
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
this.listener = listener;
this.screenHelper = screenHelper;
this.audioDataManager = audioDataManager;
+ this.optionSettings = optionSettings;
this.setIgnoreMouse(true);
- this.setIsVisible(false);
- create();
+ this.setAsContainerOnly();
}
- private void create() {
-
+ @Override
+ public void create() {
+ this.gameMode = GameMode.values()[optionSettings.getGameMode()];
+
float startPointx = screenHelper.calcX(537f);
float startPointy = screenHelper.calcY(576f);
@@ -71,43 +77,46 @@ public class GameGUI extends Panel implements Gui{
float startPointYMenu = screenHelper.calcY(200f);
float labelFontSize = screenHelper.calcX(20f);
-
- btnStart = new ButtonBase(screen, new Vector2f(startPointx, startPointy),
+
+ float pointsTimePanelWidth = screenHelper.calcX(180f);
+ float pointsTimePanelHeight = screenHelper.calcY(65f);
+
+ btnStart = new ButtonBase(screen, new Vector2f(startPointx, startPointy),
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(40f))) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.start();
}
- };
+ };
btnStart.setTextPadding(screenHelper.calcY(10f));
btnStart.setText("Launch");
btnStart.setFontSize(labelFontSize);
-
-
+
+
btnResume = new ButtonBase(screen, new Vector2f(startPointx, startPointYMenu),
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(40f))) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.resume();
}
- };
+ };
btnResume.setTextPadding(screenHelper.calcY(10f));
btnResume.setText("Resume");
btnResume.setFontSize(labelFontSize);
-
-
+
+
btnMenu = new ButtonBase(screen, new Vector2f(startPointx, startPointYMenu + screenHelper.calcY(50f)),
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(40f))) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.cancelTrack();
}
- };
+ };
btnMenu.setTextPadding(screenHelper.calcY(10f));
btnMenu.setText("Menu");
btnMenu.setFontSize(labelFontSize);
-
-
+
+
indOverheat = new Indicator(screen, new Vector2f(0f, 0f), Indicator.Orientation.VERTICAL) {
@Override
public void onChange(float arg0, float arg1) {
@@ -121,12 +130,12 @@ public class GameGUI extends Panel implements Gui{
indOverheat.setMaxValue(100f);
updateOverhead(0f);
- pointsTimePanel = new Panel(screen, new Vector2f(startPointPointsx, startPointPointsy), new Vector2f(screenHelper.calcX(180f), screenHelper.calcY(65f)));
-
+ pointsTimePanel = new Panel(screen, new Vector2f(startPointPointsx, startPointPointsy), new Vector2f(pointsTimePanelWidth, pointsTimePanelHeight));
+
lblPoints = new Label(screen, new Vector2f(screenHelper.calcX(5f), 0), new Vector2f(screenHelper.calcX(150f), screenHelper.calcY(30f)));
lblPoints.setFontColor(new ColorRGBA(1f, 0f, 0f, 1f));
lblPoints.setFontSize(screenHelper.calcX(30f));
-
+
lblRemainingTime = new Label(screen, new Vector2f(screenHelper.calcX(5f), screenHelper.calcX(25f)), new Vector2f(screenHelper.calcX(150f), screenHelper.calcY(30f)));
lblRemainingTime.setFontColor(new ColorRGBA(1f, 0f, 0f, 1f));
lblRemainingTime.setFontSize(screenHelper.calcX(30f));
@@ -177,10 +186,12 @@ public class GameGUI extends Panel implements Gui{
pointsTimePanel.show();
}
+ @Override
public void attach() {
screen.addElement(this);
}
+ @Override
public void detach() {
screen.removeElement(this);
}
@@ -192,10 +203,10 @@ public class GameGUI extends Panel implements Gui{
public void setPoints(String points) {
lblPoints.setText("Score: " + points);
}
-
+
public void setRemainingTime(float remainingTime) {
- int seconds = (int)remainingTime / 1000;
- int min = (int)(seconds / 60);
+ int seconds = (int) remainingTime / 1000;
+ int min = (int) (seconds / 60);
lblRemainingTime.setText("Time: " + min + ":" + String.format("%02d", (seconds - min * 60)));
}
@@ -205,6 +216,7 @@ public class GameGUI extends Panel implements Gui{
this.addControl(new GuiMusicRemainingTimeControl(audioDataManager, this));
}
+ @Override
public void refresh() {
}
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/Gui.java b/ShootingStars/src/org/wyrez/shootingstars/gui/Gui.java
index 4857e92..16b0e2a 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/Gui.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/Gui.java
@@ -22,8 +22,10 @@ package org.wyrez.shootingstars.gui;
*/
public interface Gui {
+ public void create();
+
public void refresh();
-
+
public void attach();
public void detach();
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/HighscoreGUI.java b/ShootingStars/src/org/wyrez/shootingstars/gui/HighscoreGUI.java
index 719d334..9063113 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/HighscoreGUI.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/HighscoreGUI.java
@@ -24,12 +24,13 @@ import java.util.List;
import org.wyrez.shootingstars.gui.controls.ButtonBase;
import org.wyrez.shootingstars.gui.listener.HighscoreListener;
import org.wyrez.shootingstars.gui.manager.HighscoreManager;
-import org.wyrez.shootingstars.gui.model.Score;
+import org.wyrez.shootingstars.gui.model.ClassicScore;
import org.wyrez.shootingstars.helper.ScreenHelper;
import tonegod.gui.controls.buttons.Button;
-import tonegod.gui.controls.text.Label;
+import tonegod.gui.controls.lists.Table;
+import tonegod.gui.controls.lists.Table.TableColumn;
+import tonegod.gui.controls.lists.Table.TableRow;
import tonegod.gui.controls.text.TextField;
-import tonegod.gui.controls.windows.Panel;
import tonegod.gui.core.Screen;
/**
@@ -41,8 +42,8 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
private HighscoreListener listener;
private HighscoreManager highscoreManager;
private ScreenHelper screenHelper;
- private Panel plnScores;
private TextField txtFilter;
+ private Table classicTable;
public HighscoreGUI(Screen screen, HighscoreListener listener, HighscoreManager highscoreManager,
ScreenHelper screenHelper, AssetManager assetManager) {
@@ -51,55 +52,35 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
this.highscoreManager = highscoreManager;
this.screenHelper = screenHelper;
this.setIgnoreMouse(true);
- this.setIsVisible(false);
- plnScores = new Panel(screen, new Vector2f(0f, 0f),new Vector2f(0f, 0f));
- create();
+ this.setAsContainerOnly();
}
+ @Override
public void attach() {
screen.addElement(this);
}
+ @Override
public void detach() {
screen.removeElement(this);
}
- private void create() {
- float startPointx = screenHelper.calcX(32f);
- float startPointy = screenHelper.calcY(18f);
+ @Override
+ public void create() {
+ float startPointX = screenHelper.calcX(32f);
+ float startPointY = screenHelper.calcY(80f);
+
+ float marginTableLeft = screenHelper.calcX(7f);
- float marginScoreNameLeft = screenHelper.calcX(14f);
- float marginScorePointsLeft = screenHelper.calcX(300f);
- float marginScoreDateLeft = screenHelper.calcX(420f);
- float marginScoreSongNameLeft = screenHelper.calcX(600f);
-
float labelFontSize = screenHelper.calcX(20f);
-
+
float buttonHeight = screenHelper.calcY(40f);
float buttonWidth = screenHelper.calcX(180f);
float buttonFontSize = screenHelper.calcX(18f);
- List highscores = highscoreManager.getScores();
+ createClassicHighscore(startPointX,startPointY,marginTableLeft,labelFontSize);
- Label lblScoreNameHead = new Label(screen, new Vector2f(startPointx + marginScoreNameLeft, startPointy), new Vector2f(screenHelper.calcX(250f), screenHelper.calcY(40f)));
- lblScoreNameHead.setText("Name");
- lblScoreNameHead.setFontSize(labelFontSize);
-
- Label lblScorePointsHead = new Label(screen, new Vector2f(startPointx + marginScorePointsLeft, startPointy), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
- lblScorePointsHead.setText("Points");
- lblScorePointsHead.setFontSize(labelFontSize);
-
- Label lblScoreDateHead = new Label(screen, new Vector2f(startPointx + marginScoreDateLeft, startPointy), new Vector2f(screenHelper.calcX(180f), screenHelper.calcY(40f)));
- lblScoreDateHead.setText("Date");
- lblScoreDateHead.setFontSize(labelFontSize);
-
- Label lblScoreSongNameHead = new Label(screen, new Vector2f(startPointx + marginScoreSongNameLeft, startPointy), new Vector2f(screenHelper.calcX(600f), screenHelper.calcY(40f)));
- lblScoreSongNameHead.setText("Song Name");
- lblScoreSongNameHead.setFontSize(labelFontSize);
-
- drawHighscores(highscores);
-
- Button btnBack = new ButtonBase(screen, new Vector2f(startPointx + screenHelper.calcX(1060f), startPointy + screenHelper.calcY(622.8f)), new Vector2f(screenHelper.calcX(153f), buttonHeight)) {
+ Button btnBack = new ButtonBase(screen, new Vector2f(startPointX + screenHelper.calcX(1060f), startPointY + screenHelper.calcY(560.8f)), new Vector2f(screenHelper.calcX(153f), buttonHeight)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.back();
@@ -108,13 +89,13 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
btnBack.setTextPadding(screenHelper.calcY(10f));
btnBack.setText("Back");
btnBack.setFontSize(buttonFontSize);
-
+
txtFilter = new TextField(screen, new Vector2f(screenHelper.calcX(800f), screenHelper.calcY(15f)), new Vector2f(screenHelper.calcX(280f), screenHelper.calcY(40f)));
-
+
Button btnFilter = new ButtonBase(screen, new Vector2f(screenHelper.calcX(1092f), screenHelper.calcY(15f)), new Vector2f(buttonWidth, buttonHeight)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
- List scores = highscoreManager.getScoresWithSongName(txtFilter.getText());
+ List scores = highscoreManager.getClassicScoresWithSongName(txtFilter.getText());
drawHighscores(scores);
}
};
@@ -122,66 +103,71 @@ public class HighscoreGUI extends BackgroundedGui implements Gui {
btnFilter.setText("Filter Song Name");
btnFilter.setFontSize(buttonFontSize);
- this.addChild(lblScoreNameHead);
- this.addChild(lblScorePointsHead);
- this.addChild(lblScoreDateHead);
- this.addChild(lblScoreSongNameHead);
- this.addChild(plnScores);
+ this.addChild(classicTable);
this.addChild(txtFilter);
this.addChild(btnFilter);
this.addChild(btnBack);
}
+
+ private void createClassicHighscore(float startPointX, float startPointY, float marginTableLeft, float labelFontSize) {
+ List highscores = highscoreManager.getClassicScores();
+
+ classicTable = new Table(screen, new Vector2f(startPointX + marginTableLeft, startPointY),new Vector2f(screenHelper.calcX(1205f), screenHelper.calcY(550f))) {
+ @Override
+ public void onChange() {
+ }
+ };
+
+ TableColumn placeColumn = new TableColumn(classicTable, screen, "Place");
+ placeColumn.setDimensions(screenHelper.calcX(35f), screenHelper.calcY(40f));
+ placeColumn.setText("");
+ placeColumn.setFontSize(labelFontSize);
+ classicTable.addColumn(placeColumn);
+ TableColumn nameColumn = new TableColumn(classicTable, screen, "Name");
+ nameColumn.setDimensions(screenHelper.calcX(190f), screenHelper.calcY(40f));
+ nameColumn.setText("Name");
+ nameColumn.setFontSize(labelFontSize);
+ classicTable.addColumn(nameColumn);
+ TableColumn pointsColumn = new TableColumn(classicTable, screen, "Points");
+ pointsColumn.setDimensions(screenHelper.calcX(110f), screenHelper.calcY(40f));
+ pointsColumn.setText("Points");
+ pointsColumn.setFontSize(labelFontSize);
+ classicTable.addColumn(pointsColumn);
+ TableColumn dateColumn = new TableColumn(classicTable, screen, "Date");
+ dateColumn.setDimensions(screenHelper.calcX(170f), screenHelper.calcY(40f));
+ dateColumn.setText("Date");
+ dateColumn.setFontSize(labelFontSize);
+ classicTable.addColumn(dateColumn);
+ TableColumn songNameColumn = new TableColumn(classicTable, screen, "Song Name");
+ songNameColumn.setDimensions(screenHelper.calcX(693f), screenHelper.calcY(40f));
+ songNameColumn.setText("Song Name");
+ songNameColumn.setFontSize(labelFontSize);
+ classicTable.addColumn(songNameColumn);
- public void refresh() {
- List highscores = highscoreManager.getScores();
drawHighscores(highscores);
}
-
- private void drawHighscores(List scores) {
- plnScores.detachAllChildren();
-
- float startPointx = screenHelper.calcX(32f);
- float startPointy = screenHelper.calcY(18f);
- float marginScoreNameLeft = screenHelper.calcX(14f);
- float marginScorePointsLeft = screenHelper.calcX(300f);
- float marginScoreDateLeft = screenHelper.calcX(420f);
- float marginScoreSongNameLeft = screenHelper.calcX(600f);
-
- float marginScoreTop = screenHelper.calcY(50f);
+ @Override
+ public void refresh() {
+ List highscores = highscoreManager.getClassicScores();
+ drawHighscores(highscores);
+ }
+ private void drawHighscores(List scores) {
float labelFontSize = screenHelper.calcX(20f);
- int maxScores = 0;
- if (scores.size() > 10) {
- maxScores = 10;
- } else {
- maxScores = scores.size();
- }
-
- for (int i = 0; i < maxScores; i++) {
- Score score = scores.get(i);
- Label lblScoreName = new Label(screen, new Vector2f(startPointx + marginScoreNameLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(250f), screenHelper.calcY(40f)));
- lblScoreName.setText(score.getPlayerName());
- lblScoreName.setFontSize(labelFontSize);
-
- Label lblScorePoints = new Label(screen, new Vector2f(startPointx + marginScorePointsLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
- lblScorePoints.setText(String.valueOf(score.getScore()));
- lblScorePoints.setFontSize(labelFontSize);
+ classicTable.removeAllRows();
+ for (int i = 0; i < scores.size(); i++) {
- Label lblScoreDate = new Label(screen, new Vector2f(startPointx + marginScoreDateLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(180f), screenHelper.calcY(40f)));
- lblScoreDate.setText(DateFormat.getDateTimeInstance().format(score.getDate()));
- lblScoreDate.setFontSize(labelFontSize);
-
- Label lblScoreSongName = new Label(screen, new Vector2f(startPointx + marginScoreSongNameLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(600f), screenHelper.calcY(40f)));
- lblScoreSongName.setText(score.getSongName());
- lblScoreSongName.setFontSize(labelFontSize);
-
- plnScores.addChild(lblScoreName);
- plnScores.addChild(lblScorePoints);
- plnScores.addChild(lblScoreDate);
- plnScores.addChild(lblScoreSongName);
- marginScoreTop += screenHelper.calcY(50f);
+ ClassicScore score = scores.get(i);
+ TableRow row = new TableRow(screen, classicTable);
+ row.setFontSize(labelFontSize);
+ row.addCell(String.valueOf(i + 1), i);
+ row.addCell(score.getPlayerName(), i);
+ row.addCell(String.valueOf(score.getScore()), i);
+ row.addCell(DateFormat.getDateTimeInstance().format(score.getDate()), i);
+ row.addCell(score.getSongName(), i);
+ classicTable.addRow(row);
}
}
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/LoadingGui.java b/ShootingStars/src/org/wyrez/shootingstars/gui/LoadingGui.java
index 281f606..a8d3afa 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/LoadingGui.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/LoadingGui.java
@@ -42,12 +42,11 @@ public class LoadingGui extends BackgroundedGui implements Gui {
assetManager, "Textures/ShootingStars.png"); //create for full hd
this.screenHelper = screenHelper;
this.setIgnoreMouse(true);
- this.setIsVisible(false);
- create();
+ this.setAsContainerOnly();
}
- private void create() {
-
+ @Override
+ public void create() {
float startPointx = screenHelper.calcX(537f);
float startPointy = screenHelper.calcY(576f);
float distancePogressbarLabely = screenHelper.calcY(36f);
@@ -55,9 +54,9 @@ public class LoadingGui extends BackgroundedGui implements Gui {
indProgress = new IndicatorBase(screen, new Vector2f(startPointx, startPointy),
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)), Indicator.Orientation.HORIZONTAL);
- indProgress.setDisplayValues();
+ indProgress.setDisplayValues();
indProgress.setMaxValue(LoadingProgress.getProgressCount());
- indProgress.setIndicatorColor(ColorRGBA.Black);
+ indProgress.setIndicatorColor(ColorRGBA.Black);
lblStatus = new Label(screen, new Vector2f(startPointx, startPointy + distancePogressbarLabely), new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)));
lblStatus.setTextAlign(BitmapFont.Align.Center);
@@ -67,10 +66,12 @@ public class LoadingGui extends BackgroundedGui implements Gui {
this.addChild(lblStatus);
}
+ @Override
public void attach() {
screen.addElement(this);
}
+ @Override
public void detach() {
screen.removeElement(this);
}
@@ -80,6 +81,7 @@ public class LoadingGui extends BackgroundedGui implements Gui {
indProgress.setCurrentValue(progress.getValue());
}
+ @Override
public void refresh() {
}
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/MenuGUI.java b/ShootingStars/src/org/wyrez/shootingstars/gui/MenuGUI.java
index 0bcd612..08426d9 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/MenuGUI.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/MenuGUI.java
@@ -25,6 +25,7 @@ import org.wyrez.shootingstars.helper.ScreenHelper;
import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.text.Label;
import tonegod.gui.core.Screen;
+import tonegod.gui.core.layouts.MigLayout;
/**
*
@@ -40,11 +41,14 @@ public class MenuGUI extends BackgroundedGui implements Gui {
this.listener = listener;
this.screenHelper = screenHelper;
this.setIgnoreMouse(true);
- this.setIsVisible(false);
- create();
+ this.setAsContainerOnly();
}
- private void create() {
+ @Override
+ public void create() {
+ //MigLayout ml = new MigLayout(screen, "[70][15][15]", "[35][15][15][35]", "");
+
+
float startPointx = screenHelper.calcX(256f);
float startPointy = screenHelper.calcY(252f);
float labelFontSize = screenHelper.calcX(89f);
@@ -112,13 +116,16 @@ public class MenuGUI extends BackgroundedGui implements Gui {
this.addChild(lblShootingStars);
}
+ @Override
public void refresh() {
}
+ @Override
public void attach() {
screen.addElement(this);
}
+ @Override
public void detach() {
screen.removeElement(this);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/OptionsGUI.java b/ShootingStars/src/org/wyrez/shootingstars/gui/OptionsGUI.java
index ee2f158..b0f7f0f 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/OptionsGUI.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/OptionsGUI.java
@@ -21,6 +21,7 @@ import com.jme3.input.event.MouseButtonEvent;
import com.jme3.math.Vector2f;
import org.wyrez.shootingstars.gui.controls.ButtonBase;
import org.wyrez.shootingstars.gui.listener.OptionsListener;
+import org.wyrez.shootingstars.gui.model.GameMode;
import org.wyrez.shootingstars.helper.DisplayHelper;
import org.wyrez.shootingstars.helper.ScreenHelper;
import org.wyrez.shootingstars.states.util.OptionSettings;
@@ -44,6 +45,7 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
//General Controls
private TextField txtPlayerName;
private CheckBox chkEnableAudioVisualization;
+ private ComboBox cboGameMode;
//Video Controls
private ComboBox cboResolution;
private ComboBox cboFrequency;
@@ -63,20 +65,21 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
this.settings = settings;
this.screenHelper = screenHelper;
this.setIgnoreMouse(true);
- this.setIsVisible(false);
- create();
- readControlValues();
+ this.setAsContainerOnly();
}
+ @Override
public void attach() {
screen.addElement(this);
}
+ @Override
public void detach() {
screen.removeElement(this);
}
- private void create() {
+ @Override
+ public void create() {
float tabControlStartPointx = screenHelper.calcX(32f);
float tabControlStartPointy = screenHelper.calcY(18f);
@@ -114,6 +117,8 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
this.addChild(btnSave);
this.addChild(btnCancel);
+
+ readControlValues();
}
private void createGeneral(float labelFontSize) {
@@ -125,6 +130,9 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
float startPointAudioVisualy = screenHelper.calcY(36f);
float marginLeftAudioVisualControl = screenHelper.calcX(190f);
+ float comboBoxWidth = screenHelper.calcX(200f);
+ float comboBoxHeight = screenHelper.calcY(30f);
+
Label lblPlayerName = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
lblPlayerName.setText("Player Name");
lblPlayerName.setFontSize(labelFontSize);
@@ -138,10 +146,26 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
chkEnableAudioVisualization = new CheckBox(screen, new Vector2f(startPointAudioVisualx + marginLeftAudioVisualControl, startPointAudioVisualy + screenHelper.calcY(12f)), new Vector2f(screenHelper.calcX(20f), screenHelper.calcX(20f)));
+ Label lblGameMode = new Label(screen, new Vector2f(startPointx, startPointy + screenHelper.calcY(308f)), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
+ lblGameMode.setText("Game Mode");
+ lblGameMode.setFontSize(labelFontSize);
+
+ cboGameMode = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(315f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
+ @Override
+ public void onChange(int selectedIndex, Object value) {
+ }
+ };
+ cboGameMode.setFontSize(labelFontSize);
+ for (GameMode gm : GameMode.values()) {
+ cboGameMode.addListItem(gm.toString(), gm);
+ }
+
this.addChild(lblPlayerName);
this.addChild(txtPlayerName);
this.addChild(lblEnableAudioVisualization);
this.addChild(chkEnableAudioVisualization);
+ this.addChild(lblGameMode);
+ this.addChild(cboGameMode);
}
private void createVideo(float labelFontSize) {
@@ -291,6 +315,7 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
//General
txtPlayerName.setText(settings.getUsername());
chkEnableAudioVisualization.setIsChecked(settings.isAudioVisualizationEnabled());
+ setComboBoxValue(cboGameMode, GameMode.values()[settings.getGameMode()].name());
//Video
setComboBoxValue(cboResolution, resolution);
@@ -308,7 +333,7 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
private void setComboBoxValue(ComboBox comboBox, String value) {
for (int i = 0; i < comboBox.getListItems().size(); i++) {
- if (comboBox.getListItems().get(i).getValue().equals(value)) {
+ if (comboBox.getListItems().get(i).getValue().toString().equalsIgnoreCase(value)) {
comboBox.setSelectedIndex(i);
}
}
@@ -318,6 +343,7 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
//General
settings.setUsername(txtPlayerName.getText());
settings.setEnableAudioVisualization(chkEnableAudioVisualization.getIsChecked());
+ settings.setGameMode(cboGameMode.getSelectIndex());
//Video
String resolution[] = cboResolution.getSelectedListItem().getValue().toString().split(" x ");
@@ -337,6 +363,8 @@ public class OptionsGUI extends BackgroundedGui implements Gui {
settings.save();
}
+ @Override
public void refresh() {
+ create();
}
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/SelectTrackGUI.java b/ShootingStars/src/org/wyrez/shootingstars/gui/SelectTrackGUI.java
index f38dc92..987abf9 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/SelectTrackGUI.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/SelectTrackGUI.java
@@ -41,11 +41,11 @@ public class SelectTrackGUI extends BackgroundedGui implements Gui {
this.listener = listener;
this.screenHelper = screenHelper;
this.setIgnoreMouse(true);
- this.setIsVisible(false);
- create();
+ this.setAsContainerOnly();
}
- private void create() {
+ @Override
+ public void create() {
float startPointx = screenHelper.calcX(576f);
float startPointy = screenHelper.calcY(260f);
float labelFontSize = screenHelper.calcX(76f);
@@ -98,13 +98,16 @@ public class SelectTrackGUI extends BackgroundedGui implements Gui {
this.addChild(btnCancel);
}
+ @Override
public void refresh() {
}
+ @Override
public void attach() {
screen.addElement(this);
}
+ @Override
public void detach() {
screen.removeElement(this);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/YTDownloadGUI.java b/ShootingStars/src/org/wyrez/shootingstars/gui/YTDownloadGUI.java
index ca68470..77f87cc 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/YTDownloadGUI.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/YTDownloadGUI.java
@@ -42,11 +42,11 @@ public class YTDownloadGUI extends BackgroundedGui implements Gui {
this.listener = listener;
this.screenHelper = screenHelper;
this.setIgnoreMouse(true);
- this.setIsVisible(false);
- create();
+ this.setAsContainerOnly();
}
- private void create() {
+ @Override
+ public void create() {
float startPointx = screenHelper.calcX(384f);
float startPointy = screenHelper.calcY(324f);
float labelFontSize = screenHelper.calcX(51.2f);
@@ -99,13 +99,16 @@ public class YTDownloadGUI extends BackgroundedGui implements Gui {
this.addChild(btnCancel);
}
+ @Override
public void refresh() {
}
+ @Override
public void attach() {
screen.addElement(this);
}
+ @Override
public void detach() {
screen.removeElement(this);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/controls/ButtonBase.java b/ShootingStars/src/org/wyrez/shootingstars/gui/controls/ButtonBase.java
index 8b5d44d..be7bdaf 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/controls/ButtonBase.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/controls/ButtonBase.java
@@ -16,14 +16,10 @@
*/
package org.wyrez.shootingstars.gui.controls;
-import com.jme3.input.event.MouseButtonEvent;
-import com.jme3.input.event.MouseMotionEvent;
import com.jme3.math.Vector2f;
import com.jme3.math.Vector4f;
-import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.buttons.ButtonAdapter;
import tonegod.gui.core.ElementManager;
-import tonegod.gui.core.Screen;
/**
*
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/controls/IndicatorBase.java b/ShootingStars/src/org/wyrez/shootingstars/gui/controls/IndicatorBase.java
index 1a7a731..2d4f5b7 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/controls/IndicatorBase.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/controls/IndicatorBase.java
@@ -34,7 +34,7 @@ public class IndicatorBase extends Indicator {
}
public IndicatorBase(ElementManager screen, Vector2f position, Vector2f dimensions, Orientation orientation) {
- super(screen, position, dimensions, orientation);
+ super(screen, position, dimensions, orientation, true);
init();
}
@@ -54,7 +54,7 @@ public class IndicatorBase extends Indicator {
}
public IndicatorBase(ElementManager screen, String UID, Vector2f position, Vector2f dimensions, Vector4f resizeBorders, String defaultImg, Orientation orientation) {
- super(screen, UID, position, dimensions, resizeBorders, defaultImg, orientation);
+ super(screen, UID, position, dimensions, resizeBorders, defaultImg, orientation, true);
init();
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/manager/HighscoreManager.java b/ShootingStars/src/org/wyrez/shootingstars/gui/manager/HighscoreManager.java
index 44dd49a..a1a05a1 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/manager/HighscoreManager.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/manager/HighscoreManager.java
@@ -25,13 +25,13 @@ import java.sql.ResultSet;
import java.text.DateFormat;
import java.util.*;
import org.wyrez.shootingstars.game.GameSettings;
-import org.wyrez.shootingstars.gui.model.Score;
+import org.wyrez.shootingstars.gui.model.ClassicScore;
import org.wyrez.shootingstars.io.SQLiteConnector;
import org.wyrez.shootingstars.states.util.OptionSettings;
public class HighscoreManager {
- private List scores;
+ private List classicScores;
private Connection connection;
private SQLiteConnector connector;
private ScoreComparator scoreComparator;
@@ -40,33 +40,35 @@ public class HighscoreManager {
this.connector = connector;
this.scoreComparator = scoreComparator;
connection = connector.initDBConnection();
- scores = new ArrayList();
- loadScoreFile();
+ classicScores = new ArrayList();
+ loadClassicScoreDB();
}
- public List getScores() {
- sort(scores);
- return scores;
+ public List getClassicScores() {
+ sort(classicScores);
+ return classicScores;
}
- private void sort(List scores) {
+ private void sort(List scores) {
Collections.sort(scores, scoreComparator);
}
public void addScore(GameSettings gameSettings, OptionSettings optionSettings, int score) {
String songName = gameSettings.getTrackArtist() + " ~ " + gameSettings.getTrackTitle();
Date date = new Date(System.currentTimeMillis());
- scores.add(new Score(songName, optionSettings.getUsername(), score, date));
- updateScoreFile(optionSettings.getUsername(), score, songName, date);
+
+
+ classicScores.add(new ClassicScore(songName, optionSettings.getUsername(), score, date));
+ updateClassicScoreDB(optionSettings.getUsername(), score, songName, date);
}
- public List getScoresWithSongName(String songName) {
- List tempScores = new ArrayList();
+ public List getClassicScoresWithSongName(String songName) {
+ List tempScores = new ArrayList();
try {
- ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM Scores WHERE LOWER(SongName) LIKE LOWER('%" + songName + "%');");
+ ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM ClassicScores WHERE LOWER(SongName) LIKE LOWER('%" + songName + "%');");
while (rs.next()) {
- tempScores.add(new Score(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points"), DateFormat.getDateTimeInstance().parse(rs.getString("GameDate"))));
+ tempScores.add(new ClassicScore(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points"), DateFormat.getDateTimeInstance().parse(rs.getString("GameDate"))));
}
rs.close();
} catch (Exception ex) {
@@ -75,20 +77,20 @@ public class HighscoreManager {
return tempScores;
}
- private void loadScoreFile() {
+ private void loadClassicScoreDB() {
try {
- ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM Scores;");
+ ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM ClassicScores;");
while (rs.next()) {
- scores.add(new Score(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points"), DateFormat.getDateTimeInstance().parse(rs.getString("GameDate"))));
+ classicScores.add(new ClassicScore(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points"), DateFormat.getDateTimeInstance().parse(rs.getString("GameDate"))));
}
rs.close();
} catch (Exception ex) {
}
}
- private void updateScoreFile(String name, int score, String songName, Date date) {
+ private void updateClassicScoreDB(String name, int score, String songName, Date date) {
try {
- connector.excecuteUpdate(connection, "INSERT INTO Scores(Name,Points,SongName,GameDate) values('" + name + "'," + score + ", '" + songName + "', '" + DateFormat.getDateTimeInstance().format(date) + "' )");
+ connector.excecuteUpdate(connection, "INSERT INTO ClassicScores(Name,Points,SongName,GameDate) values('" + name + "'," + score + ", '" + songName + "', '" + DateFormat.getDateTimeInstance().format(date) + "' )");
} catch (Exception ex) {
}
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/manager/ScoreComparator.java b/ShootingStars/src/org/wyrez/shootingstars/gui/manager/ScoreComparator.java
index 29ae90a..6e54776 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/manager/ScoreComparator.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/manager/ScoreComparator.java
@@ -21,11 +21,11 @@ package org.wyrez.shootingstars.gui.manager;
* @author Rappold
*/
import java.util.Comparator;
-import org.wyrez.shootingstars.gui.model.Score;
+import org.wyrez.shootingstars.gui.model.ClassicScore;
-public class ScoreComparator implements Comparator {
+public class ScoreComparator implements Comparator {
- public int compare(Score score1, Score score2) {
+ public int compare(ClassicScore score1, ClassicScore score2) {
int sc1 = score1.getScore();
int sc2 = score2.getScore();
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/model/Score.java b/ShootingStars/src/org/wyrez/shootingstars/gui/model/ClassicScore.java
similarity index 88%
rename from ShootingStars/src/org/wyrez/shootingstars/gui/model/Score.java
rename to ShootingStars/src/org/wyrez/shootingstars/gui/model/ClassicScore.java
index 694a2d9..56fa3d2 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/gui/model/Score.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/model/ClassicScore.java
@@ -23,14 +23,14 @@ package org.wyrez.shootingstars.gui.model;
import java.io.Serializable;
import java.util.Date;
-public class Score implements Serializable {
+public class ClassicScore implements Serializable {
private int score;
private String playerName;
private String songName;
private Date date;
- public Score(String songName, String playerName, int score, Date date) {
+ public ClassicScore(String songName, String playerName, int score, Date date) {
this.songName = songName;
this.score = score;
this.playerName = playerName;
diff --git a/ShootingStars/src/org/wyrez/shootingstars/gui/model/GameMode.java b/ShootingStars/src/org/wyrez/shootingstars/gui/model/GameMode.java
new file mode 100644
index 0000000..94023b4
--- /dev/null
+++ b/ShootingStars/src/org/wyrez/shootingstars/gui/model/GameMode.java
@@ -0,0 +1,12 @@
+package org.wyrez.shootingstars.gui.model;
+
+/**
+ *
+ * @author Snowsun
+ */
+public enum GameMode {
+ Classic,
+ RushEasy,
+ RushNormal,
+ RushHard
+}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/io/SQLiteConnector.java b/ShootingStars/src/org/wyrez/shootingstars/io/SQLiteConnector.java
index 7867f0a..e31a4ac 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/io/SQLiteConnector.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/io/SQLiteConnector.java
@@ -24,11 +24,13 @@ import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
+import java.sql.SQLException;
import java.sql.Statement;
public class SQLiteConnector {
private static final String DB_PATH = "scoresdb.db";
+ private static final String VERSION = "1.1";
public SQLiteConnector() {
}
@@ -39,19 +41,20 @@ public class SQLiteConnector {
try {
Class.forName("org.sqlite.JDBC");
- String sqliteTable = "CREATE TABLE Scores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250), GameDate DATE)";
File sQLiteDb = new File(DB_PATH);
if (!sQLiteDb.exists()) {
- sQLiteDb.createNewFile();
- newFile = true;
+ sQLiteDb.createNewFile();
+ newFile = true;
}
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
-
- if(newFile) {
- Statement stmt = connection.createStatement();
- stmt.executeUpdate(sqliteTable);
+
+ if (newFile) {
+ createNewTables(connection);
+ } else {
+ updateTables(connection);
}
+
return connection;
} catch (Exception ex) {
ex.printStackTrace();
@@ -59,6 +62,57 @@ public class SQLiteConnector {
return null;
}
+ private void createNewTables(Connection connection) throws SQLException {
+ Statement stmt = connection.createStatement();
+
+ String query = "CREATE TABLE ClassicScores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250), GameDate DATE)";
+ stmt.executeUpdate(query);
+
+ query = "CREATE TABLE RushScores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250), GameDate DATE, UsedTime INT(20))";
+ stmt.executeUpdate(query);
+
+ query = "CREATE TABLE Version (Number VARCHAR(20))";
+ stmt.executeUpdate(query);
+
+ query = "INSERT INTO Version (Number) values('" + VERSION + "')";
+ stmt.executeUpdate(query);
+ }
+
+ private void updateTables(Connection connection) throws SQLException {
+
+ Statement stmt = connection.createStatement();
+
+ String query = "SELECT name FROM sqlite_master WHERE type='table' AND name='Version';";
+
+ ResultSet resultSet = stmt.executeQuery(query);
+ if(resultSet.next()) { //DatabaseVersion 1.1 or higher
+ resultSet.close();
+
+ query = "Select Number From Version";
+ ResultSet rs = stmt.executeQuery(query);
+ if(rs.next()) {
+ String versionNumber = rs.getString("Number");
+ rs.close();
+ //todo stuff later here when tables are changed
+ }
+
+ rs.close();
+ } else { //DatabaseVersion 1.0
+ resultSet.close();
+ query = "ALTER TABLE Scores RENAME TO ClassicScores;";
+ stmt.executeUpdate(query);
+
+ query = "CREATE TABLE RushScores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250), GameDate DATE, UsedTime INT(20))";
+ stmt.executeUpdate(query);
+
+ query = "CREATE TABLE Version (Number VARCHAR(20))";
+ stmt.executeUpdate(query);
+
+ query = "INSERT INTO Version (Number) values('" + VERSION + "')";
+ stmt.executeUpdate(query);
+ }
+ }
+
public ResultSet excecuteQuery(Connection con, String query) {
ResultSet result = null;
try {
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/FileMetaInfoState.java b/ShootingStars/src/org/wyrez/shootingstars/states/FileMetaInfoState.java
index c66d4af..1319d15 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/FileMetaInfoState.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/FileMetaInfoState.java
@@ -39,12 +39,15 @@ public class FileMetaInfoState extends AbstractAppState implements FileMetaInfoL
GameSettings settings, ScreenHelper screenHelper, AssetManager assetManager) {
this.stateManager = stateManager;
this.gui = new FileMetaInfoGUI(screen, this, settings, screenHelper, assetManager);
+ this.gui.create();
}
+ @Override
public void startLoading() {
stateManager.setState(State.LOADING);
}
+ @Override
public void cancel() {
stateManager.setState(State.MENU);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/GameState.java b/ShootingStars/src/org/wyrez/shootingstars/states/GameState.java
index d940848..b6212e4 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/GameState.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/GameState.java
@@ -84,15 +84,16 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
this.rootNode = rootNode;
this.audioDataManager = audioDataManager;
- this.gui = new GameGUI(screen, this, screenHelper,audioDataManager);
+ this.optionSettings = optionSettings;
+ this.gui = new GameGUI(screen, this, screenHelper,audioDataManager, optionSettings);
+ this.gui.create();
this.stateManager = stateManager;
inputManager.addListener(this, new String[]{"ESC"});
this.inputManager = inputManager;
this.camera = camera;
this.assetManager = assetManager;
- this.viewPort = viewPort;
- this.optionSettings = optionSettings;
+ this.viewPort = viewPort;
this.highscoreManager = highscoreManager;
this.settings = settings;
@@ -147,6 +148,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
player.setUserData(UserDataKeys.RUNNING, running);
}
+ @Override
public void start() {
gui.setStart();
inputManager.setCursorVisible(false);
@@ -215,6 +217,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
return isRunning;
}
+ @Override
public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals("ESC") && !isPressed) {
if (isRunning) {
@@ -233,6 +236,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
gui.showMenu();
}
+ @Override
public void resume() {
gui.resumeGame();
inputManager.setCursorVisible(false);
@@ -246,6 +250,7 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
stateManager.setState(State.HIGHSCORE);
}
+ @Override
public void cancelTrack() {
stateManager.setState(State.MENU);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/HighscoreState.java b/ShootingStars/src/org/wyrez/shootingstars/states/HighscoreState.java
index 6f4d5ab..0f96759 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/HighscoreState.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/HighscoreState.java
@@ -41,9 +41,11 @@ public class HighscoreState extends AbstractAppState implements HighscoreListene
ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) {
this.stateManager = stateManager;
this.gui = new HighscoreGUI(screen, this, highscoreManager, screenHelper, assetManager);
+ this.gui.create();
this.music = music;
}
+ @Override
public void back() {
stateManager.setState(State.MENU);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/LoadingState.java b/ShootingStars/src/org/wyrez/shootingstars/states/LoadingState.java
index d88d121..b4b5695 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/LoadingState.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/LoadingState.java
@@ -50,6 +50,7 @@ public class LoadingState extends AbstractAppState {
ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) {
this.stateManager = stateManager;
this.gui = new LoadingGui(screen, screenHelper, assetManager);
+ this.gui.create();
this.audioDataManager = audioDataManager;
this.settings = settings;
this.music = music;
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/MenuState.java b/ShootingStars/src/org/wyrez/shootingstars/states/MenuState.java
index bc6e4d8..269e346 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/MenuState.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/MenuState.java
@@ -42,23 +42,32 @@ public class MenuState extends AbstractAppState implements MenuListener {
ScreenHelper screenHelper, BackgroundMusic music, AssetManager assetManager) {
this.stateManager = stateManager;
this.gui = new MenuGUI(screen, this, screenHelper, assetManager);
+ this.gui.create();
this.shootingStars = shootingStars;
this.music = music;
}
+
+ public Gui getGui() {
+ return gui;
+ }
+ @Override
public void selectFile() {
stateManager.setState(State.SELECTTRACK);
}
+ @Override
public void exitGame() {
shootingStars.stop();
System.exit(0);
}
+ @Override
public void openhighscore() {
stateManager.setState(State.HIGHSCORE);
}
+ @Override
public void openOptions() {
stateManager.setState(State.OPTIONS);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/OptionsState.java b/ShootingStars/src/org/wyrez/shootingstars/states/OptionsState.java
index f12840e..8166628 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/OptionsState.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/OptionsState.java
@@ -19,7 +19,11 @@ package org.wyrez.shootingstars.states;
import com.jme3.app.state.AbstractAppState;
import com.jme3.app.state.AppStateManager;
import com.jme3.asset.AssetManager;
+import java.lang.reflect.InvocationTargetException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import org.wyrez.shootingstars.ShootingStars;
+import org.wyrez.shootingstars.gui.Gui;
import org.wyrez.shootingstars.gui.OptionsGUI;
import org.wyrez.shootingstars.gui.listener.OptionsListener;
import org.wyrez.shootingstars.helper.ScreenHelper;
@@ -46,6 +50,7 @@ public class OptionsState extends AbstractAppState implements OptionsListener {
this.stateManager = stateManager;
this.settings = settings;
this.gui = new OptionsGUI(screen, this, settings, screenHelper, assetManager);
+ this.gui.create();
this.music = music;
}
@@ -59,13 +64,15 @@ public class OptionsState extends AbstractAppState implements OptionsListener {
gui.detach();
}
+ @Override
public void save() {
shootingStars.setSettings(settings.getAppSettings());
- shootingStars.restart();
+ shootingStars.restart();
stateManager.setState(State.MENU);
music.update();
}
+ @Override
public void cancel() {
stateManager.setState(State.MENU);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/SelectTrackState.java b/ShootingStars/src/org/wyrez/shootingstars/states/SelectTrackState.java
index 00a91a8..077b44a 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/SelectTrackState.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/SelectTrackState.java
@@ -60,6 +60,7 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
this.stateManager = stateManager;
this.settings = settings;
this.gui = new SelectTrackGUI(screen, this, screenHelper, assetManager);
+ this.gui.create();
}
@Override
@@ -130,6 +131,7 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
}
}
+ @Override
public void selectFile() {
wasFullscreen = optionSettings.isFullscreenEnabled();
selectState = 0;
@@ -138,6 +140,7 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
private void readMetadata(String file) {
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet");
DirectMediaPlayer mediaPlayer = mediaPlayerFactory.newDirectMediaPlayer(1, 1, new RenderCallback() {
+ @Override
public void display(DirectMediaPlayer dmp, Memory[] memorys, BufferFormat bf) {
}
});
@@ -158,10 +161,12 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
mediaPlayerFactory.release();
}
+ @Override
public void downloadYT() {
stateManager.setState(State.YTDOWNLOAD);
}
+ @Override
public void cancel() {
stateManager.setState(State.MENU);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/YTDownloadState.java b/ShootingStars/src/org/wyrez/shootingstars/states/YTDownloadState.java
index 3f318a7..e5fda85 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/YTDownloadState.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/YTDownloadState.java
@@ -59,6 +59,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
this.stateManager = stateManager;
this.settings = settings;
this.gui = new YTDownloadGUI(screen, this, screenHelper, assetManager);
+ this.gui.create();
this.downloader = downloader;
}
@@ -72,6 +73,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
gui.detach();
}
+ @Override
public void downloadYTVideo(String url) {
try {
Matcher matcher = YT_LINK_PATTERN.matcher(url);
@@ -119,6 +121,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
private void readMetadata() {
MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet");
DirectMediaPlayer mediaPlayer = mediaPlayerFactory.newDirectMediaPlayer(1, 1, new RenderCallback() {
+ @Override
public void display(DirectMediaPlayer dmp, Memory[] memorys, BufferFormat bf) {
}
});
@@ -141,6 +144,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
mediaPlayerFactory.release();
}
+ @Override
public void cancel() {
stateManager.setState(State.MENU);
}
diff --git a/ShootingStars/src/org/wyrez/shootingstars/states/util/OptionSettings.java b/ShootingStars/src/org/wyrez/shootingstars/states/util/OptionSettings.java
index db2af14..973aabd 100644
--- a/ShootingStars/src/org/wyrez/shootingstars/states/util/OptionSettings.java
+++ b/ShootingStars/src/org/wyrez/shootingstars/states/util/OptionSettings.java
@@ -81,6 +81,7 @@ public class OptionSettings {
setShowWeapon(true);
setVSync(true);
setEnableAudioVisualization(true);
+ setGameMode(0);
}
}
@@ -151,6 +152,10 @@ public class OptionSettings {
public void setThirdLastPlayedTrack(String thirdLastPlayedTrack) {
settings.putString("ThirdLastPlayedTrack", thirdLastPlayedTrack);
}
+
+ public void setGameMode(int gameMode) {
+ settings.putInteger("GameMode", gameMode);
+ }
public String getUsername() {
return settings.getString("Username");
@@ -219,6 +224,10 @@ public class OptionSettings {
public String getThirdLastPlayedTrack() {
return settings.getString("ThirdLastPlayedTrack");
}
+
+ public int getGameMode() {
+ return settings.getInteger("GameMode");
+ }
public void save() {
try {