merged
This commit is contained in:
commit
0d2ec02510
BIN
ShootingStars/lib/sqlite-jdbc-3.7.2.jar
Normal file
BIN
ShootingStars/lib/sqlite-jdbc-3.7.2.jar
Normal file
Binary file not shown.
@ -45,6 +45,7 @@ file.reference.jogg-0.0.7.jar=lib\\jogg-0.0.7.jar
|
||||
file.reference.jorbis-0.0.15.jar=lib\\jorbis-0.0.15.jar
|
||||
file.reference.mp3spi1.9.5.jar=lib\\mp3spi1.9.5.jar
|
||||
file.reference.platform-3.5.2.jar=lib\\platform-3.5.2.jar
|
||||
file.reference.sqlite-jdbc-3.7.2.jar=lib\\sqlite-jdbc-3.7.2.jar
|
||||
file.reference.tritonus_aos-0.3.6.jar=lib\\tritonus_aos-0.3.6.jar
|
||||
file.reference.tritonus_jorbis-0.3.6.jar=lib\\tritonus_jorbis-0.3.6.jar
|
||||
file.reference.tritonus_share-0.3.6.jar=lib\\tritonus_share-0.3.6.jar
|
||||
@ -85,7 +86,8 @@ javac.classpath=\
|
||||
${file.reference.wget-1.2.7.jar}:\
|
||||
${file.reference.xmlpull-1.1.3.1.jar}:\
|
||||
${file.reference.xpp3_min-1.1.4c.jar}:\
|
||||
${file.reference.xstream-1.4.2.jar}
|
||||
${file.reference.xstream-1.4.2.jar}:\
|
||||
${file.reference.sqlite-jdbc-3.7.2.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
|
||||
@ -33,6 +33,10 @@ import org.wyrez.shootingstars.data.AudioDataManager;
|
||||
import org.wyrez.shootingstars.data.YTDownloader;
|
||||
import org.wyrez.shootingstars.factories.Materials;
|
||||
import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.gui.manager.HighscoreManager;
|
||||
import org.wyrez.shootingstars.gui.manager.ScoreComparator;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import org.wyrez.shootingstars.io.SQLiteConnector;
|
||||
import org.wyrez.shootingstars.states.State;
|
||||
import org.wyrez.shootingstars.states.StateManager;
|
||||
import org.wyrez.shootingstars.states.util.OptionSettings;
|
||||
@ -83,7 +87,11 @@ public class ShootingStars extends SimpleApplication {
|
||||
container.registerSingleton(OptionSettings.class, optionSettings);
|
||||
container.registerType(GameSettings.class, true);
|
||||
container.registerType(StateManager.class, true);
|
||||
container.registerType(SQLiteConnector.class, true);
|
||||
container.registerType(ScoreComparator.class, true);
|
||||
container.registerType(HighscoreManager.class, true);
|
||||
container.registerType(Screen.class, true);
|
||||
container.registerType(ScreenHelper.class, true);
|
||||
container.registerType(AudioDataManager.class, true);
|
||||
container.registerType(YTDownloader.class);
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.wyrez.shootingstars.controls;
|
||||
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.control.Control;
|
||||
import org.wyrez.shootingstars.helper.UserDataKeys;
|
||||
@ -27,19 +28,29 @@ import org.wyrez.shootingstars.helper.UserDataKeys;
|
||||
public class StarPointControl extends BaseControl {
|
||||
|
||||
private int points = 100; //Todo Change StartPoint at Spawn
|
||||
|
||||
public StarPointControl() {
|
||||
private Spatial player;
|
||||
private ColorRGBA starColor;
|
||||
|
||||
public StarPointControl(Spatial player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void controlUpdate(float tpf) {
|
||||
if (spatial.getUserData(UserDataKeys.HITTED)) {
|
||||
//Todo Check life time and set points
|
||||
int pointsToAdd = Integer.parseInt(player.getUserData(UserDataKeys.POINTS).toString()) + points;
|
||||
player.setUserData(UserDataKeys.POINTS, pointsToAdd);
|
||||
} else {
|
||||
points -= tpf / 2;
|
||||
if(points < 75) {
|
||||
starColor = new ColorRGBA(0.5f, 0.5f, 0.5f, 1f);
|
||||
//Todo Set color to spatial
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Control cloneForSpatial(Spatial spatial) {
|
||||
StarPointControl control = new StarPointControl();
|
||||
StarPointControl control = new StarPointControl(player);
|
||||
spatial.addControl(control);
|
||||
return control;
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import org.jaudiotagger.tag.Tag;
|
||||
import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.gui.controls.ButtonBase;
|
||||
import org.wyrez.shootingstars.gui.listener.FileMetaInfoListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
@ -40,25 +41,28 @@ public class FileMetaInfoGUI extends Panel implements Gui {
|
||||
|
||||
private FileMetaInfoListener listener;
|
||||
private GameSettings settings;
|
||||
private ScreenHelper screenHelper;
|
||||
private String fileName = "";
|
||||
private String duration = "";
|
||||
private String title = "";
|
||||
private String artist = "";
|
||||
|
||||
public FileMetaInfoGUI(Screen screen, FileMetaInfoListener listener, GameSettings settings) {
|
||||
public FileMetaInfoGUI(Screen screen, FileMetaInfoListener listener, GameSettings settings, ScreenHelper screenHelper) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f));
|
||||
this.listener = listener;
|
||||
this.settings = settings;
|
||||
this.screenHelper = screenHelper;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float startPointx = 256f;
|
||||
float startPointy = 202f;
|
||||
float marginLeft = 110f;
|
||||
float buttonWidth = 153.6f;
|
||||
float startPointx = screenHelper.calcX(256f);
|
||||
float startPointy = screenHelper.calcY(202f);
|
||||
float marginLeft = screenHelper.calcX(110f);
|
||||
float buttonWidth = screenHelper.calcX(153.6f);
|
||||
float labelFontSize = screenHelper.calcX(20f);
|
||||
|
||||
File file = null;
|
||||
if(settings.useVideo()) {
|
||||
@ -69,45 +73,55 @@ public class FileMetaInfoGUI extends Panel implements Gui {
|
||||
|
||||
readMetaData(file);
|
||||
|
||||
Label lblFileNameHead = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(100f, 40f));
|
||||
Label lblFileNameHead = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(screenHelper.calcX(100f), screenHelper.calcY(40f)));
|
||||
lblFileNameHead.setText("Track Name");
|
||||
lblFileNameHead.setFontSize(labelFontSize);
|
||||
|
||||
Label lblFileName = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy), new Vector2f(400f, 40f));
|
||||
Label lblFileName = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy), new Vector2f(screenHelper.calcX(400f), screenHelper.calcY(40f)));
|
||||
lblFileName.setText(fileName);
|
||||
lblFileName.setFontSize(labelFontSize);
|
||||
|
||||
Label lblArtistHead = new Label(screen, new Vector2f(startPointx, startPointy + 50f), new Vector2f(100f, 40f));
|
||||
Label lblArtistHead = new Label(screen, new Vector2f(startPointx, startPointy + screenHelper.calcY(50f)), new Vector2f(screenHelper.calcX(100f), screenHelper.calcY(40f)));
|
||||
lblArtistHead.setText("Artist");
|
||||
lblArtistHead.setFontSize(labelFontSize);
|
||||
|
||||
Label lblArtist = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 50f), new Vector2f(400f, 40f));
|
||||
Label lblArtist = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + screenHelper.calcY(50f)), new Vector2f(screenHelper.calcX(400f), screenHelper.calcY(40f)));
|
||||
lblArtist.setText(artist);
|
||||
lblArtist.setFontSize(labelFontSize);
|
||||
|
||||
Label lblTitelHead = new Label(screen, new Vector2f(startPointx, startPointy + 100f), new Vector2f(100f, 40f));
|
||||
Label lblTitelHead = new Label(screen, new Vector2f(startPointx, startPointy + screenHelper.calcY(100f)), new Vector2f(screenHelper.calcX(100f), screenHelper.calcY(40f)));
|
||||
lblTitelHead.setText("Titel");
|
||||
lblTitelHead.setFontSize(labelFontSize);
|
||||
|
||||
Label lblTitel = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 100f), new Vector2f(400f, 40f));
|
||||
Label lblTitel = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + screenHelper.calcY(100f)), new Vector2f(screenHelper.calcX(400f), screenHelper.calcY(40f)));
|
||||
lblTitel.setText(title);
|
||||
lblTitel.setFontSize(labelFontSize);
|
||||
|
||||
Label lblDurationHead = new Label(screen, new Vector2f(startPointx, startPointy + 150f), new Vector2f(100f, 40f));
|
||||
Label lblDurationHead = new Label(screen, new Vector2f(startPointx, startPointy + screenHelper.calcY(150f)), new Vector2f(screenHelper.calcX(100f), screenHelper.calcY(40f)));
|
||||
lblDurationHead.setText("Duration");
|
||||
lblDurationHead.setFontSize(labelFontSize);
|
||||
|
||||
Label lblDuration = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 150f), new Vector2f(400f, 40f));
|
||||
Label lblDuration = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + screenHelper.calcY(150f)), new Vector2f(screenHelper.calcX(400f), screenHelper.calcY(40f)));
|
||||
lblDuration.setText(duration);
|
||||
lblDuration.setFontSize(labelFontSize);
|
||||
|
||||
Button btnStartLoading = new ButtonBase(screen, new Vector2f(startPointx + 653f, startPointy + 438.8f), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnStartLoading = new ButtonBase(screen, new Vector2f(startPointx + screenHelper.calcX(653f), startPointy + screenHelper.calcY(438.8f)), new Vector2f(buttonWidth, screenHelper.calcY(40))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.startLoading();
|
||||
}
|
||||
};
|
||||
btnStartLoading.setText("Play");
|
||||
btnStartLoading.setFontSize(labelFontSize);
|
||||
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx + 836f, startPointy + 438.8f), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx + screenHelper.calcX(836f), startPointy + screenHelper.calcY(438.8f)), new Vector2f(buttonWidth, screenHelper.calcY(40))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancel();
|
||||
}
|
||||
};
|
||||
btnCancel.setText("Cancel");
|
||||
btnCancel.setFontSize(labelFontSize);
|
||||
|
||||
this.addChild(lblFileNameHead);
|
||||
this.addChild(lblFileName);
|
||||
|
||||
@ -25,8 +25,10 @@ import com.jme3.math.Vector2f;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.ui.Picture;
|
||||
import org.wyrez.shootingstars.gui.controls.ButtonBase;
|
||||
import org.wyrez.shootingstars.gui.controls.GuiPlayerPointsControl;
|
||||
import org.wyrez.shootingstars.gui.controls.IndicatorBase;
|
||||
import org.wyrez.shootingstars.gui.listener.GameListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.extras.Indicator;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
@ -47,11 +49,15 @@ public class GameGUI extends Panel {
|
||||
private Picture picCrosshair;
|
||||
private Indicator indOverheat;
|
||||
private AssetManager assetManager;
|
||||
private Spatial player;
|
||||
private Label lblPoints;
|
||||
private ScreenHelper screenHelper;
|
||||
|
||||
public GameGUI(Screen screen, GameListener listener, AssetManager assetManager) {
|
||||
public GameGUI(Screen screen, GameListener listener, AssetManager assetManager, ScreenHelper screenHelper) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.assetManager = assetManager;
|
||||
this.screenHelper = screenHelper;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
@ -59,19 +65,24 @@ public class GameGUI extends Panel {
|
||||
|
||||
private void create() {
|
||||
|
||||
float startPointx = 537f;
|
||||
float startPointy = 576f;
|
||||
float startPointx = screenHelper.calcX(537f);
|
||||
float startPointy = screenHelper.calcY(576f);
|
||||
|
||||
float startPointCrosshairx = 441f;
|
||||
float startPointCrosshairy = 560f;
|
||||
float startPointCrosshairx = screenHelper.calcX(441f);
|
||||
float startPointCrosshairy = screenHelper.calcY(560f);
|
||||
|
||||
float startPointOverheatx = 505f;
|
||||
float startPointOverheaty = 270f;
|
||||
float startPointOverheatx = screenHelper.calcX(505f);
|
||||
float startPointOverheaty = screenHelper.calcY(270f);
|
||||
|
||||
float startPointYMenu = 200f;
|
||||
float startPointPointsx = screenHelper.calcX(1100f);
|
||||
float startPointPointsy = screenHelper.calcY(25f);
|
||||
|
||||
float startPointYMenu = screenHelper.calcY(200f);
|
||||
|
||||
float labelFontSize = screenHelper.calcX(20f);
|
||||
|
||||
btnStart = new ButtonBase(screen, new Vector2f(startPointx, startPointy),
|
||||
new Vector2f(200f, 30f)) {
|
||||
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.start();
|
||||
@ -79,9 +90,10 @@ public class GameGUI extends Panel {
|
||||
};
|
||||
btnStart.setText("Launch");
|
||||
btnStart.setTextAlign(BitmapFont.Align.Center);
|
||||
btnStart.setFontSize(labelFontSize);
|
||||
|
||||
btnResume = new ButtonBase(screen, new Vector2f(startPointx, startPointYMenu),
|
||||
new Vector2f(200f, 30f)) {
|
||||
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.resume();
|
||||
@ -89,9 +101,10 @@ public class GameGUI extends Panel {
|
||||
};
|
||||
btnResume.setText("Resume");
|
||||
btnResume.setTextAlign(BitmapFont.Align.Center);
|
||||
btnResume.setFontSize(labelFontSize);
|
||||
|
||||
btnMenu = new ButtonBase(screen, new Vector2f(startPointx, startPointYMenu + 40f),
|
||||
new Vector2f(200f, 30f)) {
|
||||
btnMenu = new ButtonBase(screen, new Vector2f(startPointx, startPointYMenu + screenHelper.calcY(40f)),
|
||||
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancelTrack();
|
||||
@ -99,10 +112,11 @@ public class GameGUI extends Panel {
|
||||
};
|
||||
btnMenu.setText("Menu");
|
||||
btnMenu.setTextAlign(BitmapFont.Align.Center);
|
||||
btnMenu.setFontSize(labelFontSize);
|
||||
|
||||
picCrosshair = new Picture("Crosshair");
|
||||
picCrosshair.setWidth(400f);
|
||||
picCrosshair.setHeight(400f);
|
||||
picCrosshair.setWidth(screenHelper.calcX(400f));
|
||||
picCrosshair.setHeight(screenHelper.calcY(400f));
|
||||
picCrosshair.setImage(assetManager, "Textures/Crosshair.png", true);
|
||||
|
||||
Panel plnCrosshair = new Panel(screen, new Vector2f(startPointCrosshairx, startPointCrosshairy), new Vector2f(0f, 0f));
|
||||
@ -111,22 +125,28 @@ public class GameGUI extends Panel {
|
||||
plnCrosshair.attachChild(picCrosshair);
|
||||
|
||||
indOverheat = new IndicatorBase(screen, new Vector2f(startPointOverheatx, startPointOverheaty),
|
||||
new Vector2f(275f, 180f), Indicator.Orientation.VERTICAL);
|
||||
indOverheat.setIndicatorColor(new ColorRGBA(0f, 0f, 1f, 0.5f));
|
||||
new Vector2f(screenHelper.calcX(275f), screenHelper.calcY(180f)), Indicator.Orientation.VERTICAL);
|
||||
//indOverheat.setIndicatorColor(new ColorRGBA(0f, 0f, 1f, 0.5f));
|
||||
indOverheat.setAlphaMap("Textures/Crosshair_AlphaMap.png");
|
||||
indOverheat.setOverlayImage("Textures/Crosshair_OverlayImage.png");
|
||||
//indOverheat.setBaseImage("Textures/Crosshair_Overheat_Fog.png");
|
||||
indOverheat.setIndicatorImage("Textures/Crosshair_Overheat_Fog.png");
|
||||
|
||||
lblPoints = new Label(screen, new Vector2f(startPointPointsx, startPointPointsy), new Vector2f(screenHelper.calcX(275f), screenHelper.calcY(180f)));
|
||||
lblPoints.setFontColor(new ColorRGBA(1f, 0f, 0f, 1f));
|
||||
lblPoints.setFontSize(screenHelper.calcX(50f));
|
||||
|
||||
this.addChild(btnStart);
|
||||
this.addChild(btnResume);
|
||||
this.addChild(btnMenu);
|
||||
this.addChild(indOverheat);
|
||||
this.addChild(plnCrosshair);
|
||||
this.addChild(lblPoints);
|
||||
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
indOverheat.hide();
|
||||
lblPoints.hide();
|
||||
}
|
||||
|
||||
public void setStart() {
|
||||
@ -135,6 +155,7 @@ public class GameGUI extends Panel {
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Inherit);
|
||||
indOverheat.show();
|
||||
lblPoints.show();
|
||||
}
|
||||
|
||||
public void setWait() {
|
||||
@ -143,6 +164,7 @@ public class GameGUI extends Panel {
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
indOverheat.hide();
|
||||
lblPoints.hide();
|
||||
}
|
||||
|
||||
public void showMenu() {
|
||||
@ -151,6 +173,7 @@ public class GameGUI extends Panel {
|
||||
btnMenu.show();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
indOverheat.hide();
|
||||
lblPoints.hide();
|
||||
}
|
||||
|
||||
public void resumeGame() {
|
||||
@ -159,6 +182,7 @@ public class GameGUI extends Panel {
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Inherit);
|
||||
indOverheat.show();
|
||||
lblPoints.show();
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
@ -172,8 +196,17 @@ public class GameGUI extends Panel {
|
||||
public void updateOverhead(float percent) {
|
||||
indOverheat.setCurrentValue(percent);
|
||||
}
|
||||
|
||||
public void setPoints(String points) {
|
||||
lblPoints.setText(points);
|
||||
}
|
||||
|
||||
public void setMaxTimeToOverheat(float maxTimeToOverheat) {
|
||||
indOverheat.setMaxValue(maxTimeToOverheat);
|
||||
}
|
||||
|
||||
public void setPlayer(Spatial player) {
|
||||
this.player = player;
|
||||
this.addControl(new GuiPlayerPointsControl(player, this));
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,7 +21,9 @@ import com.jme3.math.Vector2f;
|
||||
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.helper.ScreenHelper;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
@ -34,14 +36,16 @@ import tonegod.gui.core.Screen;
|
||||
public class HighscoreGUI extends Panel implements Gui {
|
||||
|
||||
private HighscoreListener listener;
|
||||
//private HighscoreManager highscoreManager;
|
||||
private HighscoreManager highscoreManager;
|
||||
private ScreenHelper screenHelper;
|
||||
|
||||
public HighscoreGUI(Screen screen, HighscoreListener listener) {
|
||||
public HighscoreGUI(Screen screen, HighscoreListener listener, HighscoreManager highscoreManager, ScreenHelper screenHelper) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f));
|
||||
this.listener = listener;
|
||||
this.highscoreManager = highscoreManager;
|
||||
this.screenHelper = screenHelper;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
//highscoreManager = new HighscoreManager();
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
}
|
||||
|
||||
@ -54,64 +58,66 @@ public class HighscoreGUI extends Panel implements Gui {
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float startPointx = 32f;
|
||||
float startPointy = 18f;
|
||||
float startPointx = screenHelper.calcX(32f);
|
||||
float startPointy = screenHelper.calcY(18f);
|
||||
|
||||
//Only Test
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 50);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 150);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 250);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 350);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 450);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 550);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 650);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 750);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 850);
|
||||
// highscoreManager.addScore("Lied Name", "Chris", 950);
|
||||
// highscoreManager.updateScoreFile();
|
||||
float marginScoreNameLeft = screenHelper.calcX(14f);
|
||||
float marginScorePointsLeft = screenHelper.calcX(300f);
|
||||
float marginScoreSongNameLeft = screenHelper.calcX(600f);
|
||||
|
||||
float marginScoreTop = screenHelper.calcY(50f);
|
||||
|
||||
float labelFontSize = screenHelper.calcX(20f);
|
||||
|
||||
float marginScoreNameLeft = 14f;
|
||||
float marginScorePointsLeft = 300f;
|
||||
float marginScoreSongNameLeft = 600f;
|
||||
List<Score> highscores = highscoreManager.getScores();
|
||||
|
||||
float marginScoreTop = 50f;
|
||||
|
||||
//List<Score> highscores = highscoreManager.getScores();
|
||||
|
||||
Label lblScoreNameHead = new Label(screen, new Vector2f(startPointx + marginScoreNameLeft, startPointy), new Vector2f(250f, 40f));
|
||||
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(250f, 40f));
|
||||
Label lblScorePointsHead = new Label(screen, new Vector2f(startPointx + marginScorePointsLeft, startPointy), new Vector2f(screenHelper.calcX(250f), screenHelper.calcY(40f)));
|
||||
lblScorePointsHead.setText("Points");
|
||||
lblScorePointsHead.setFontSize(labelFontSize);
|
||||
|
||||
Label lblScoreSongNameHead = new Label(screen, new Vector2f(startPointx + marginScoreSongNameLeft, startPointy), new Vector2f(600f, 40f));
|
||||
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);
|
||||
|
||||
// for (int i = 0; i < 10; i++) {
|
||||
// Score score = highscores.get(i);
|
||||
// Label lblScoreName = new Label(screen, new Vector2f(startPointx + marginScoreNameLeft, startPointy + marginScoreTop), new Vector2f(250f, 40f));
|
||||
// lblScoreName.setText(score.getPlayerName());
|
||||
//
|
||||
// Label lblScorePoints = new Label(screen, new Vector2f(startPointx + marginScorePointsLeft, startPointy + marginScoreTop), new Vector2f(250f, 40f));
|
||||
// lblScorePoints.setText(String.valueOf(score.getScore()));
|
||||
//
|
||||
// Label lblScoreSongName = new Label(screen, new Vector2f(startPointx + marginScoreSongNameLeft, startPointy + marginScoreTop), new Vector2f(600f, 40f));
|
||||
// lblScoreSongName.setText(score.getSongName());
|
||||
//
|
||||
// this.addChild(lblScoreName);
|
||||
// this.addChild(lblScorePoints);
|
||||
// this.addChild(lblScoreSongName);
|
||||
// marginScoreTop += 50f;
|
||||
// }
|
||||
int maxScores = 0;
|
||||
if(highscores.size() > 10) {
|
||||
maxScores = 10;
|
||||
} else {
|
||||
maxScores = highscores.size();
|
||||
}
|
||||
|
||||
for (int i = 0; i < maxScores; i++) {
|
||||
Score score = highscores.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);
|
||||
|
||||
Button btnBack = new ButtonBase(screen, new Vector2f(startPointx + 1060f, startPointy + 622.8f), new Vector2f(153f, 40)) {
|
||||
Label lblScorePoints = new Label(screen, new Vector2f(startPointx + marginScorePointsLeft, startPointy + marginScoreTop), new Vector2f(screenHelper.calcX(250f), screenHelper.calcY(40f)));
|
||||
lblScorePoints.setText(String.valueOf(score.getScore()));
|
||||
lblScorePoints.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);
|
||||
|
||||
this.addChild(lblScoreName);
|
||||
this.addChild(lblScorePoints);
|
||||
this.addChild(lblScoreSongName);
|
||||
marginScoreTop += screenHelper.calcY(50f);
|
||||
}
|
||||
|
||||
Button btnBack = new ButtonBase(screen, new Vector2f(startPointx + screenHelper.calcX(1060f), startPointy + screenHelper.calcY(622.8f)), new Vector2f(screenHelper.calcX(153f), screenHelper.calcY(40f))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.back();
|
||||
}
|
||||
};
|
||||
btnBack.setText("Back");
|
||||
btnBack.setFontSize(labelFontSize);
|
||||
|
||||
this.addChild(lblScoreNameHead);
|
||||
this.addChild(lblScorePointsHead);
|
||||
|
||||
@ -20,6 +20,7 @@ import com.jme3.font.BitmapFont;
|
||||
import com.jme3.math.ColorRGBA;
|
||||
import com.jme3.math.Vector2f;
|
||||
import org.wyrez.shootingstars.gui.controls.IndicatorBase;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import org.wyrez.shootingstars.states.util.LoadingProgress;
|
||||
import tonegod.gui.controls.extras.Indicator;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
@ -34,9 +35,11 @@ public class LoadingGui extends Panel {
|
||||
|
||||
private Label lblStatus;
|
||||
private Indicator indProgress;
|
||||
private ScreenHelper screenHelper;
|
||||
|
||||
public LoadingGui(Screen screen) {
|
||||
public LoadingGui(Screen screen, ScreenHelper screenHelper) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.screenHelper = screenHelper;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
@ -44,17 +47,17 @@ public class LoadingGui extends Panel {
|
||||
|
||||
private void create() {
|
||||
|
||||
float startPointx = 537f;//screen.getWidth() * 0.42f;
|
||||
float startPointy = 576f;//screen.getHeight() * 0.80f;
|
||||
float distancePogressbarLabely = 36f;
|
||||
float startPointx = screenHelper.calcX(537f);
|
||||
float startPointy = screenHelper.calcY(576f);
|
||||
float distancePogressbarLabely = screenHelper.calcY(36f);
|
||||
|
||||
indProgress = new IndicatorBase(screen, new Vector2f(startPointx, startPointy),
|
||||
new Vector2f(200f, 30f), Indicator.Orientation.HORIZONTAL);
|
||||
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)), Indicator.Orientation.HORIZONTAL);
|
||||
indProgress.setDisplayValues();
|
||||
indProgress.setMaxValue(LoadingProgress.getProgressCount());
|
||||
indProgress.setIndicatorColor(ColorRGBA.Black);
|
||||
|
||||
lblStatus = new Label(screen, new Vector2f(startPointx, startPointy + distancePogressbarLabely), new Vector2f(200f, 30f));
|
||||
lblStatus = new Label(screen, new Vector2f(startPointx, startPointy + distancePogressbarLabely), new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)));
|
||||
lblStatus.setTextAlign(BitmapFont.Align.Center);
|
||||
|
||||
this.addChild(indProgress);
|
||||
|
||||
@ -20,6 +20,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.MenuListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
@ -32,10 +33,12 @@ import tonegod.gui.core.Screen;
|
||||
public class MenuGUI extends Panel implements Gui {
|
||||
|
||||
private MenuListener listener;
|
||||
private ScreenHelper screenHelper;
|
||||
|
||||
public MenuGUI(Screen screen, MenuListener listener) {
|
||||
public MenuGUI(Screen screen, MenuListener listener, ScreenHelper screenHelper) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.screenHelper = screenHelper;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
@ -43,55 +46,60 @@ public class MenuGUI extends Panel implements Gui {
|
||||
|
||||
private void create() {
|
||||
|
||||
float startPointx = 256f;
|
||||
float startPointy = 252f;
|
||||
float labelFontSize = 89f;
|
||||
float buttonLabelDistancex = 512f;
|
||||
float buttonButtonDistancex = buttonLabelDistancex + 192f;
|
||||
float buttonButtonDistancey = 90f;
|
||||
float buttonWidth = 153f;
|
||||
float marginButtonTop = 25f;
|
||||
float distanceLabelLabely = 60f;
|
||||
float startPointx = screenHelper.calcX(256f);
|
||||
float startPointy = screenHelper.calcY(252f);
|
||||
float labelFontSize = screenHelper.calcX(89f);
|
||||
float buttonLabelDistancex = screenHelper.calcX(512f);
|
||||
float buttonButtonDistancex = buttonLabelDistancex + screenHelper.calcX(192f);
|
||||
float buttonButtonDistancey = screenHelper.calcY(90f);
|
||||
float buttonWidth = screenHelper.calcX(153f);
|
||||
float marginButtonTop = screenHelper.calcY(25f);
|
||||
float distanceLabelLabely = screenHelper.calcY(60f);
|
||||
float buttonFontSize = screenHelper.calcX(20f);
|
||||
|
||||
Label lblWyrez = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(300, 40));
|
||||
Label lblWyrez = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(screenHelper.calcX(300), screenHelper.calcY(40)));
|
||||
lblWyrez.setFontSize(labelFontSize);
|
||||
lblWyrez.setText("Wyrez");
|
||||
|
||||
Label lblShootingStars = new Label(screen, new Vector2f(startPointx, startPointy + distanceLabelLabely), new Vector2f(500, 40));
|
||||
Label lblShootingStars = new Label(screen, new Vector2f(startPointx, startPointy + distanceLabelLabely), new Vector2f(screenHelper.calcX(500), screenHelper.calcY(40)));
|
||||
lblShootingStars.setFontSize(labelFontSize);
|
||||
lblShootingStars.setText("Shooting Stars");
|
||||
|
||||
Button btnStart = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + marginButtonTop), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnStart = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + marginButtonTop), new Vector2f(buttonWidth, screenHelper.calcY(40))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.selectFile();
|
||||
}
|
||||
};
|
||||
btnStart.setText("Start Game");
|
||||
btnStart.setFontSize(buttonFontSize);
|
||||
|
||||
Button btnHighscore = new ButtonBase(screen, new Vector2f(startPointx + buttonButtonDistancex, startPointy + marginButtonTop), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnHighscore = new ButtonBase(screen, new Vector2f(startPointx + buttonButtonDistancex, startPointy + marginButtonTop), new Vector2f(buttonWidth, screenHelper.calcY(40))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.openhighscore();
|
||||
}
|
||||
};
|
||||
btnHighscore.setText("Highscore");
|
||||
btnHighscore.setFontSize(buttonFontSize);
|
||||
|
||||
Button btnOptions = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + buttonButtonDistancey), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnOptions = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + buttonButtonDistancey), new Vector2f(buttonWidth, screenHelper.calcY(40))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.openOptions();
|
||||
}
|
||||
};
|
||||
btnOptions.setText("Options");
|
||||
btnOptions.setFontSize(buttonFontSize);
|
||||
|
||||
Button btnExit = new ButtonBase(screen, new Vector2f(startPointx + buttonButtonDistancex, startPointy + buttonButtonDistancey), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnExit = new ButtonBase(screen, new Vector2f(startPointx + buttonButtonDistancex, startPointy + buttonButtonDistancey), new Vector2f(buttonWidth, screenHelper.calcY(40))) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.exitGame();
|
||||
}
|
||||
};
|
||||
btnExit.setText("Exit Game");
|
||||
btnExit.setFontSize(buttonFontSize);
|
||||
|
||||
this.addChild(btnStart);
|
||||
this.addChild(btnHighscore);
|
||||
|
||||
@ -21,6 +21,7 @@ import com.jme3.math.Vector2f;
|
||||
import org.wyrez.shootingstars.gui.controls.ButtonBase;
|
||||
import org.wyrez.shootingstars.gui.listener.OptionsListener;
|
||||
import org.wyrez.shootingstars.helper.DisplayHelper;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import org.wyrez.shootingstars.states.util.OptionSettings;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.buttons.CheckBox;
|
||||
@ -40,6 +41,8 @@ public class OptionsGUI extends Panel implements Gui {
|
||||
|
||||
private OptionsListener listener;
|
||||
private OptionSettings settings;
|
||||
private ScreenHelper screenHelper;
|
||||
|
||||
//General Controls
|
||||
private TextField txtPlayerName;
|
||||
|
||||
@ -56,10 +59,11 @@ public class OptionsGUI extends Panel implements Gui {
|
||||
private Slider sldFXVolume;
|
||||
private Slider sldSoundVolume;
|
||||
|
||||
public OptionsGUI(Screen screen, OptionsListener listener, OptionSettings settings) {
|
||||
public OptionsGUI(Screen screen, OptionsListener listener, OptionSettings settings, ScreenHelper screenHelper) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.settings = settings;
|
||||
this.screenHelper = screenHelper;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
@ -75,12 +79,15 @@ public class OptionsGUI extends Panel implements Gui {
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float tabControlStartPointx = 32f;
|
||||
float tabControlStartPointy = 18f;
|
||||
float witdhTabControl = 1216f;
|
||||
float heightTabControl = 612f;
|
||||
float tabControlStartPointx = screenHelper.calcX(32f);
|
||||
float tabControlStartPointy = screenHelper.calcY(18f);
|
||||
float witdhTabControl = screenHelper.calcX(1216f);
|
||||
float heightTabControl = screenHelper.calcY(612f);
|
||||
|
||||
float buttonWidth = 153.6f;
|
||||
float buttonWidth = screenHelper.calcX(153.6f);
|
||||
float buttonHeight = screenHelper.calcY(40f);
|
||||
|
||||
float labelFontSize = screenHelper.calcX(20f);
|
||||
|
||||
TabControl tcOptions = new TabControl(screen, "tcOptions", new Vector2f(tabControlStartPointx, tabControlStartPointy), new Vector2f(witdhTabControl, heightTabControl));
|
||||
tcOptions.setUseSlideEffect(true);
|
||||
@ -88,13 +95,13 @@ public class OptionsGUI extends Panel implements Gui {
|
||||
tcOptions.addTab("Video");
|
||||
tcOptions.addTab("Audio");
|
||||
|
||||
createGeneralTab(tcOptions);
|
||||
createVideoTab(tcOptions);
|
||||
createAudioTab(tcOptions);
|
||||
createGeneralTab(tcOptions,labelFontSize);
|
||||
createVideoTab(tcOptions,labelFontSize);
|
||||
createAudioTab(tcOptions,labelFontSize);
|
||||
|
||||
float differnceTabControlButtons = 622.8f;
|
||||
float differnceTabControlButtons = screenHelper.calcY(622.8f);
|
||||
|
||||
Button btnSave = new ButtonBase(screen, new Vector2f(tabControlStartPointx + 877f, tabControlStartPointy + differnceTabControlButtons), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnSave = new ButtonBase(screen, new Vector2f(tabControlStartPointx + screenHelper.calcX(877f), tabControlStartPointy + differnceTabControlButtons), new Vector2f(buttonWidth, buttonHeight)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
saveControlValues();
|
||||
@ -102,146 +109,181 @@ public class OptionsGUI extends Panel implements Gui {
|
||||
}
|
||||
};
|
||||
btnSave.setText("Save");
|
||||
btnSave.setFontSize(labelFontSize);
|
||||
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(tabControlStartPointx + 1060f, tabControlStartPointy + differnceTabControlButtons), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(tabControlStartPointx + screenHelper.calcX(1060f), tabControlStartPointy + differnceTabControlButtons), new Vector2f(buttonWidth, buttonHeight)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancel();
|
||||
}
|
||||
};
|
||||
btnCancel.setText("Cancel");
|
||||
btnCancel.setFontSize(labelFontSize);
|
||||
|
||||
this.addChild(tcOptions);
|
||||
this.addChild(btnSave);
|
||||
this.addChild(btnCancel);
|
||||
}
|
||||
|
||||
private void createGeneralTab(TabControl tcOptions) {
|
||||
float startPointx = 64f;
|
||||
float startPointy = 36f;
|
||||
float marginLeftControls = 115.8f;
|
||||
private void createGeneralTab(TabControl tcOptions, float labelFontSize) {
|
||||
float startPointx = screenHelper.calcX(64f);
|
||||
float startPointy = screenHelper.calcY(36f);
|
||||
float marginLeftControls = screenHelper.calcX(115.8f);
|
||||
|
||||
Label lblPlayerName = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(120f, 40f));
|
||||
Label lblPlayerName = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
|
||||
lblPlayerName.setText("PlayerName");
|
||||
lblPlayerName.setFontSize(labelFontSize);
|
||||
|
||||
txtPlayerName = new TextField(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 7f), new Vector2f(200f, 30f));
|
||||
txtPlayerName = new TextField(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(7f)), new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)));
|
||||
txtPlayerName.setFontSize(labelFontSize);
|
||||
|
||||
tcOptions.addTabChild(0, lblPlayerName);
|
||||
tcOptions.addTabChild(0, txtPlayerName);
|
||||
}
|
||||
|
||||
private void createVideoTab(TabControl tcOptions) {
|
||||
private void createVideoTab(TabControl tcOptions, float labelFontSize) {
|
||||
|
||||
float startPointx = 64f;
|
||||
float startPointy = 36f;
|
||||
float marginLeftControls = 115.8f;
|
||||
float startPointx = screenHelper.calcX(64f);
|
||||
float startPointy = screenHelper.calcY(36f);
|
||||
float marginLeftControls = screenHelper.calcX(115.8f);
|
||||
float labelWitdh = screenHelper.calcX(120f);
|
||||
float labelHeight = screenHelper.calcY(40f);
|
||||
|
||||
float comboBoxWidth = screenHelper.calcX(200f);
|
||||
float comboBoxHeight = screenHelper.calcY(30f);
|
||||
|
||||
float checkBoxWitdh = screenHelper.calcX(20f);
|
||||
float checkBoxHeight = screenHelper.calcX(20f);
|
||||
|
||||
float sliderWitdh = screenHelper.calcX(200f);
|
||||
float sliderHeight = screenHelper.calcY(30f);
|
||||
|
||||
Label lblResolution = new Label(screen, "lblResolution", new Vector2f(startPointx, startPointy), new Vector2f(100f, 40f));
|
||||
Label lblResolution = new Label(screen, "lblResolution", new Vector2f(startPointx, startPointy), new Vector2f(labelWitdh, labelHeight));
|
||||
lblResolution.setText("Resolution");
|
||||
lblResolution.setFontSize(labelFontSize);
|
||||
|
||||
cboResolution = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 7f), new Vector2f(200f, 30f)) {
|
||||
cboResolution = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(7f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
cboResolution.setFontSize(labelFontSize);
|
||||
for (String s : DisplayHelper.getResolutions()) {
|
||||
cboResolution.addListItem(s, s);
|
||||
}
|
||||
|
||||
Label lblFrequency = new Label(screen, "lblFrequency", new Vector2f(startPointx, startPointy + 40f), new Vector2f(100f, 40f));
|
||||
Label lblFrequency = new Label(screen, "lblFrequency", new Vector2f(startPointx, startPointy + screenHelper.calcY(40f)), new Vector2f(labelWitdh, labelHeight));
|
||||
lblFrequency.setText("Frequency");
|
||||
lblFrequency.setFontSize(labelFontSize);
|
||||
|
||||
cboFrequency = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 47f), new Vector2f(200f, 30f)) {
|
||||
cboFrequency = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(47f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
cboFrequency.setFontSize(labelFontSize);
|
||||
for (String s : DisplayHelper.getFrequencys()) {
|
||||
cboFrequency.addListItem(s, s);
|
||||
}
|
||||
|
||||
Label lblDepthBits = new Label(screen, "lblDepthBits", new Vector2f(startPointx, startPointy + 80f), new Vector2f(100f, 40f));
|
||||
Label lblDepthBits = new Label(screen, "lblDepthBits", new Vector2f(startPointx, startPointy + screenHelper.calcY(80f)), new Vector2f(labelWitdh, labelHeight));
|
||||
lblDepthBits.setText("DepthBits");
|
||||
lblDepthBits.setFontSize(labelFontSize);
|
||||
|
||||
cboDepthBits = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 87f), new Vector2f(200f, 30f)) {
|
||||
cboDepthBits = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(87f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
cboDepthBits.setFontSize(labelFontSize);
|
||||
for (String s : DisplayHelper.getDepthBits()) {
|
||||
cboDepthBits.addListItem(s, s);
|
||||
}
|
||||
|
||||
Label lblFullscreen = new Label(screen, "lblFullscreen", new Vector2f(startPointx, startPointy + 120f), new Vector2f(100f, 40f));
|
||||
Label lblFullscreen = new Label(screen, "lblFullscreen", new Vector2f(startPointx, startPointy + screenHelper.calcY(120f)), new Vector2f(labelWitdh, labelHeight));
|
||||
lblFullscreen.setText("Fullscreen");
|
||||
lblFullscreen.setFontSize(labelFontSize);
|
||||
|
||||
chkFullscreen = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 132f), new Vector2f(20f, 20f));
|
||||
chkFullscreen = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(132f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
|
||||
|
||||
Label lblVSync = new Label(screen, "lblVSync", new Vector2f(startPointx, startPointy + 160f), new Vector2f(100f, 40f));
|
||||
Label lblVSync = new Label(screen, "lblVSync", new Vector2f(startPointx, startPointy + screenHelper.calcY(160f)), new Vector2f(labelWitdh, labelHeight));
|
||||
lblVSync.setText("VSync");
|
||||
lblVSync.setFontSize(labelFontSize);
|
||||
|
||||
chkVSync = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 172f), new Vector2f(20f, 20f));
|
||||
chkVSync = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(172f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
|
||||
|
||||
Label lblPostProcessing = new Label(screen, "lblPostProcessing", new Vector2f(startPointx, startPointy + 200f), new Vector2f(120f, 40f));
|
||||
Label lblPostProcessing = new Label(screen, "lblPostProcessing", new Vector2f(startPointx, startPointy + screenHelper.calcY(200f)), new Vector2f(labelWitdh, labelHeight));
|
||||
lblPostProcessing.setText("PostProcessing");
|
||||
lblPostProcessing.setFontSize(labelFontSize);
|
||||
|
||||
chkPostProcessing = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 212f), new Vector2f(20f, 20f));
|
||||
chkPostProcessing = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(212f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
|
||||
|
||||
Label lblParticleDensity = new Label(screen, "lblParticleDensity", new Vector2f(startPointx, startPointy + 240f), new Vector2f(120f, 40f));
|
||||
Label lblParticleDensity = new Label(screen, "lblParticleDensity", new Vector2f(startPointx, startPointy +screenHelper.calcY(240f)), new Vector2f(labelWitdh, labelHeight));
|
||||
lblParticleDensity.setText("ParticleDensity");
|
||||
lblParticleDensity.setFontSize(labelFontSize);
|
||||
|
||||
sldParticleDensity = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 247f), new Vector2f(200f, 30f), Slider.Orientation.HORIZONTAL, false) {
|
||||
sldParticleDensity = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(247f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
sldParticleDensity.setStepIntegerRange(0, 3, 1);
|
||||
|
||||
tcOptions.addTabChild(1, lblResolution);
|
||||
tcOptions.addTabChild(1, cboResolution);
|
||||
tcOptions.addTabChild(1, lblFrequency);
|
||||
tcOptions.addTabChild(1, cboFrequency);
|
||||
tcOptions.addTabChild(1, lblDepthBits);
|
||||
tcOptions.addTabChild(1, cboDepthBits);
|
||||
tcOptions.addTabChild(1, lblFullscreen);
|
||||
tcOptions.addTabChild(1, chkFullscreen);
|
||||
|
||||
tcOptions.addTabChild(1, lblVSync);
|
||||
tcOptions.addTabChild(1, chkVSync);
|
||||
tcOptions.addTabChild(1, lblFullscreen);
|
||||
tcOptions.addTabChild(1, chkFullscreen);
|
||||
tcOptions.addTabChild(1, lblDepthBits);
|
||||
tcOptions.addTabChild(1, cboDepthBits);
|
||||
tcOptions.addTabChild(1, lblFrequency);
|
||||
tcOptions.addTabChild(1, cboFrequency);
|
||||
tcOptions.addTabChild(1, lblResolution);
|
||||
tcOptions.addTabChild(1, cboResolution);
|
||||
tcOptions.addTabChild(1, lblPostProcessing);
|
||||
tcOptions.addTabChild(1, chkPostProcessing);
|
||||
tcOptions.addTabChild(1, lblParticleDensity);
|
||||
tcOptions.addTabChild(1, sldParticleDensity);
|
||||
}
|
||||
|
||||
private void createAudioTab(TabControl tcOptions) {
|
||||
float startPointx = 64f;
|
||||
float startPointy = 36f;
|
||||
float marginLeftControls = 115.8f;
|
||||
private void createAudioTab(TabControl tcOptions, float labelFontSize) {
|
||||
float startPointx = screenHelper.calcX(64f);
|
||||
float startPointy = screenHelper.calcY(36f);
|
||||
float marginLeftControls = screenHelper.calcX(115.8f);
|
||||
|
||||
float labelWitdh = screenHelper.calcX(120f);
|
||||
float labelHeight = screenHelper.calcY(40f);
|
||||
|
||||
float sliderWitdh = screenHelper.calcX(200f);
|
||||
float sliderHeight = screenHelper.calcY(30f);
|
||||
|
||||
Label lblMasterVolume = new Label(screen, "lblMasterVolume", new Vector2f(startPointx, startPointy), new Vector2f(120f, 40f));
|
||||
Label lblMasterVolume = new Label(screen, "lblMasterVolume", new Vector2f(startPointx, startPointy), new Vector2f(labelWitdh, labelHeight));
|
||||
lblMasterVolume.setText("MasterVolume");
|
||||
lblMasterVolume.setFontSize(labelFontSize);
|
||||
|
||||
sldMasterVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 7f), new Vector2f(200f, 30f), Slider.Orientation.HORIZONTAL, false) {
|
||||
sldMasterVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(7f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
sldMasterVolume.setStepIntegerRange(0, 100, 1);
|
||||
|
||||
Label lblFXVolume = new Label(screen, "lblFXVolume", new Vector2f(startPointx, startPointy + 40f), new Vector2f(100f, 40f));
|
||||
Label lblFXVolume = new Label(screen, "lblFXVolume", new Vector2f(startPointx, startPointy + screenHelper.calcY(40f)), new Vector2f(labelWitdh, labelHeight));
|
||||
lblFXVolume.setText("FXVolume");
|
||||
lblFXVolume.setFontSize(labelFontSize);
|
||||
|
||||
sldFXVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 47f), new Vector2f(200f, 30f), Slider.Orientation.HORIZONTAL, false) {
|
||||
sldFXVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(47f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
sldFXVolume.setStepIntegerRange(0, 100, 1);
|
||||
|
||||
Label lblSoundVolume = new Label(screen, "lblSoundVolume", new Vector2f(startPointx, startPointy + 80f), new Vector2f(120f, 40f));
|
||||
Label lblSoundVolume = new Label(screen, "lblSoundVolume", new Vector2f(startPointx, startPointy + screenHelper.calcY(80f)), new Vector2f(labelWitdh, labelHeight));
|
||||
lblSoundVolume.setText("SoundVolume");
|
||||
lblSoundVolume.setFontSize(labelFontSize);
|
||||
|
||||
sldSoundVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 87f), new Vector2f(200f, 30f), Slider.Orientation.HORIZONTAL, false) {
|
||||
sldSoundVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(87f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
|
||||
@ -20,6 +20,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.SelectFileListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
@ -31,52 +32,61 @@ import tonegod.gui.core.Screen;
|
||||
*/
|
||||
public class SelectTrackGUI extends Panel implements Gui{
|
||||
|
||||
SelectFileListener listener;
|
||||
private SelectFileListener listener;
|
||||
private ScreenHelper screenHelper;
|
||||
|
||||
public SelectTrackGUI(Screen screen, SelectFileListener listener) {
|
||||
public SelectTrackGUI(Screen screen, SelectFileListener listener, ScreenHelper screenHelper) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.screenHelper = screenHelper;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float startPointx = 576f;
|
||||
float startPointy = 260f;
|
||||
float labelFontSize = 76f;
|
||||
float buttonWidth = 153f;
|
||||
float marginLabelOrLeft = 45f;
|
||||
float marginLabelOrTop = 43f;
|
||||
float marginButtonYTDownloadTop = 129f;
|
||||
float startPointx = screenHelper.calcX(576f);
|
||||
float startPointy = screenHelper.calcY(260f);
|
||||
float labelFontSize = screenHelper.calcX(76f);
|
||||
float buttonWidth = screenHelper.calcX(153f);
|
||||
float marginLabelOrLeft = screenHelper.calcX(45f);
|
||||
float marginLabelOrTop = screenHelper.calcY(43f);
|
||||
float marginButtonYTDownloadTop = screenHelper.calcY(129f);
|
||||
float buttonHeight = screenHelper.calcY(40f);
|
||||
float labelWitdh = screenHelper.calcX(100f);
|
||||
float labelHeight = screenHelper.calcY(40f);
|
||||
float buttonFontSize = screenHelper.calcX(20f);
|
||||
|
||||
Button btnSelectFile = new ButtonBase(screen, new Vector2f(startPointx, startPointy), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnSelectFile = new ButtonBase(screen, new Vector2f(startPointx, startPointy), new Vector2f(buttonWidth, buttonHeight)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.selectFile();
|
||||
}
|
||||
};
|
||||
btnSelectFile.setText("Select File");
|
||||
btnSelectFile.setFontSize(buttonFontSize);
|
||||
|
||||
Label lblOr = new Label(screen, new Vector2f(startPointx + marginLabelOrLeft, startPointy + marginLabelOrTop), new Vector2f(100, 40));
|
||||
Label lblOr = new Label(screen, new Vector2f(startPointx + marginLabelOrLeft, startPointy + marginLabelOrTop), new Vector2f(labelWitdh, labelHeight));
|
||||
lblOr.setFontSize(labelFontSize);
|
||||
lblOr.setText("Or");
|
||||
|
||||
Button btnYTDownload = new ButtonBase(screen, new Vector2f(startPointx, startPointy + marginButtonYTDownloadTop), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnYTDownload = new ButtonBase(screen, new Vector2f(startPointx, startPointy + marginButtonYTDownloadTop), new Vector2f(buttonWidth, buttonHeight)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.downloadYT();
|
||||
}
|
||||
};
|
||||
btnYTDownload.setText("YT Download");
|
||||
btnYTDownload.setFontSize(buttonFontSize);
|
||||
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx, startPointy + marginButtonYTDownloadTop + 114f), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx, startPointy + marginButtonYTDownloadTop + screenHelper.calcY(114f)), new Vector2f(buttonWidth, buttonHeight)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancel();
|
||||
}
|
||||
};
|
||||
btnCancel.setText("Cancel");
|
||||
btnCancel.setFontSize(buttonFontSize);
|
||||
|
||||
this.addChild(btnSelectFile);
|
||||
this.addChild(lblOr);
|
||||
|
||||
@ -20,6 +20,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.YTDownloadListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.text.TextField;
|
||||
@ -33,45 +34,66 @@ import tonegod.gui.core.Screen;
|
||||
public class YTDownloadGUI extends Panel implements Gui{
|
||||
|
||||
private YTDownloadListener listener;
|
||||
private ScreenHelper screenHelper;
|
||||
|
||||
public YTDownloadGUI(Screen screen, YTDownloadListener listener) {
|
||||
public YTDownloadGUI(Screen screen, YTDownloadListener listener, ScreenHelper screenHelper) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.screenHelper = screenHelper;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float startPointx = 384f;//screen.getWidth() * 0.3f;
|
||||
float startPointy = 324f;//screen.getHeight() * 0.45f;
|
||||
float labelFontSize = 51.2f;//screen.getWidth() * 0.04f;
|
||||
float buttonWidth = 153f;//screen.getWidth() * 0.12f;
|
||||
float textFieldWitdh = 409f;//screen.getWidth() * 0.32f;
|
||||
float marginTextFieldLeft = 153f;
|
||||
float marginTextFieldTop = 8.64f;
|
||||
float marginYTButtonLeft = 409f;
|
||||
float marginYTButtonTop = 72f;
|
||||
float startPointx = screenHelper.calcX(384f);
|
||||
float startPointy = screenHelper.calcY(324f);
|
||||
float labelFontSize = screenHelper.calcX(51.2f);
|
||||
float buttonWidth = screenHelper.calcX(153f);
|
||||
float textFieldWitdh = screenHelper.calcX(409f);
|
||||
float marginTextFieldLeft = screenHelper.calcX(153f);
|
||||
float marginTextFieldTop = screenHelper.calcY(8.64f);
|
||||
float marginYTButtonLeft = screenHelper.calcX(250f);
|
||||
float marginCancelButtonLeft = screenHelper.calcX(409f);
|
||||
float marginYTButtonTop = screenHelper.calcY(72f);
|
||||
float labelWitdh = screenHelper.calcX(160f);
|
||||
float labelHeight = screenHelper.calcY(40f);
|
||||
|
||||
float buttonFontSize = screenHelper.calcX(20f);
|
||||
float buttonHeight = screenHelper.calcY(40f);
|
||||
float textFieldHeight = screenHelper.calcY(40f);
|
||||
|
||||
|
||||
Label lblYTLink = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(160, 40));
|
||||
Label lblYTLink = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(labelWitdh, labelHeight));
|
||||
lblYTLink.setFontSize(labelFontSize);
|
||||
lblYTLink.setText("YT Link");
|
||||
|
||||
final TextField txtYTLink = new TextField(screen,"txtYTLink", new Vector2f(startPointx + marginTextFieldLeft, startPointy + marginTextFieldTop), new Vector2f(textFieldWitdh, 40));
|
||||
final TextField txtYTLink = new TextField(screen,"txtYTLink", new Vector2f(startPointx + marginTextFieldLeft, startPointy + marginTextFieldTop), new Vector2f(textFieldWitdh, textFieldHeight));
|
||||
txtYTLink.setType(TextField.Type.DEFAULT);
|
||||
txtYTLink.setFontSize(buttonFontSize);
|
||||
|
||||
Button btnYTDownload = new ButtonBase(screen, new Vector2f(startPointx + marginYTButtonLeft, startPointy + marginYTButtonTop), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnYTDownload = new ButtonBase(screen, new Vector2f(startPointx + marginYTButtonLeft, startPointy + marginYTButtonTop), new Vector2f(buttonWidth, buttonHeight)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.downloadYTVideo(txtYTLink.getText());
|
||||
}
|
||||
};
|
||||
btnYTDownload.setText("Download");
|
||||
btnYTDownload.setFontSize(buttonFontSize);
|
||||
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx + marginCancelButtonLeft, startPointy + marginYTButtonTop), new Vector2f(buttonWidth, buttonHeight)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancel();
|
||||
}
|
||||
};
|
||||
btnCancel.setText("Cancel");
|
||||
btnCancel.setFontSize(buttonFontSize);
|
||||
|
||||
this.addChild(lblYTLink);
|
||||
this.addChild(txtYTLink);
|
||||
this.addChild(btnYTDownload);
|
||||
this.addChild(btnCancel);
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
|
||||
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Snowsun <http://wyrez.org> and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.wyrez.shootingstars.gui.controls;
|
||||
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.control.Control;
|
||||
import org.wyrez.shootingstars.controls.BaseControl;
|
||||
import org.wyrez.shootingstars.gui.GameGUI;
|
||||
import org.wyrez.shootingstars.helper.UserDataKeys;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class GuiPlayerPointsControl extends BaseControl {
|
||||
|
||||
private Spatial player;
|
||||
private GameGUI gui;
|
||||
|
||||
public GuiPlayerPointsControl(Spatial player, GameGUI gui) {
|
||||
this.player = player;
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void controlUpdate(float tpf) {
|
||||
if(player.getUserData(UserDataKeys.POINTS) != null) {
|
||||
gui.setPoints(player.getUserData(UserDataKeys.POINTS).toString());
|
||||
}
|
||||
}
|
||||
|
||||
public Control cloneForSpatial(Spatial spatial) {
|
||||
GuiPlayerPointsControl control = new GuiPlayerPointsControl(player, gui);
|
||||
spatial.addControl(control);
|
||||
return control;
|
||||
}
|
||||
|
||||
}
|
||||
@ -23,4 +23,6 @@ package org.wyrez.shootingstars.gui.listener;
|
||||
public interface YTDownloadListener {
|
||||
|
||||
public void downloadYTVideo(String url);
|
||||
|
||||
public void cancel();
|
||||
}
|
||||
|
||||
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Rappold <http://wyrez.org> and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.wyrez.shootingstars.gui.manager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rappold
|
||||
*/
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.*;
|
||||
import org.wyrez.shootingstars.gui.model.Score;
|
||||
import org.wyrez.shootingstars.io.SQLiteConnector;
|
||||
|
||||
public class HighscoreManager {
|
||||
|
||||
private List<Score> scores;
|
||||
private Connection connection;
|
||||
private SQLiteConnector connector;
|
||||
private ScoreComparator scoreComparator;
|
||||
|
||||
public HighscoreManager(SQLiteConnector connector, ScoreComparator scoreComparator) {
|
||||
this.connector = connector;
|
||||
this.scoreComparator = scoreComparator;
|
||||
connection = connector.initDBConnection();
|
||||
scores = new ArrayList<Score>();
|
||||
loadScoreFile();
|
||||
}
|
||||
|
||||
public List<Score> getScores() {
|
||||
sort();
|
||||
return scores;
|
||||
}
|
||||
|
||||
private void sort() {
|
||||
Collections.sort(scores, scoreComparator);
|
||||
}
|
||||
|
||||
public void addScore(String songName, String name, int score) {
|
||||
scores.add(new Score(songName, name, score));
|
||||
updateScoreFile(name, score, songName);
|
||||
}
|
||||
|
||||
private void loadScoreFile() {
|
||||
try {
|
||||
ResultSet rs = connector.excecuteQuery(connection, "SELECT * FROM Scores;");
|
||||
while (rs.next()) {
|
||||
scores.add(new Score(rs.getString("SongName"), rs.getString("Name"), rs.getInt("Points")));
|
||||
}
|
||||
rs.close();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateScoreFile(String name, int score, String songName) {
|
||||
try {
|
||||
connector.excecuteUpdate(connection, "INSERT INTO Scores(Name,Points,SongName) values('" + name + "'," + score + ", '" + songName + "')");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Rappold <http://wyrez.org> and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.wyrez.shootingstars.gui.manager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rappold
|
||||
*/
|
||||
import java.util.Comparator;
|
||||
import org.wyrez.shootingstars.gui.model.Score;
|
||||
|
||||
public class ScoreComparator implements Comparator<Score> {
|
||||
public int compare(Score score1, Score score2) {
|
||||
|
||||
int sc1 = score1.getScore();
|
||||
int sc2 = score2.getScore();
|
||||
|
||||
if (sc1 > sc2){
|
||||
return -1;
|
||||
}else if (sc1 < sc2){
|
||||
return +1;
|
||||
}else{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -32,9 +32,11 @@ public class DisplayHelper {
|
||||
List<String> resolutions = new ArrayList<String>();
|
||||
|
||||
for (DisplayMode mode : GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayModes()) {
|
||||
String resolution = mode.getWidth() + " x " + mode.getHeight();
|
||||
if (!resolutions.contains(resolution)) {
|
||||
resolutions.add(resolution);
|
||||
if (mode.getWidth() >= 1024) {
|
||||
String resolution = mode.getWidth() + " x " + mode.getHeight();
|
||||
if (!resolutions.contains(resolution)) {
|
||||
resolutions.add(resolution);
|
||||
}
|
||||
}
|
||||
}
|
||||
Collections.sort(resolutions);
|
||||
@ -43,7 +45,7 @@ public class DisplayHelper {
|
||||
|
||||
public static List<String> getFrequencys() {
|
||||
List<String> frequencys = new ArrayList<String>();
|
||||
|
||||
|
||||
for (DisplayMode mode : GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayModes()) {
|
||||
if (!frequencys.contains(String.valueOf(mode.getRefreshRate()))) {
|
||||
frequencys.add(String.valueOf(mode.getRefreshRate()));
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
package org.wyrez.shootingstars.helper;
|
||||
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class ScreenHelper {
|
||||
|
||||
private static final float X = 1280;
|
||||
private static final float Y = 720;
|
||||
private Screen screen;
|
||||
|
||||
|
||||
public ScreenHelper(Screen screen) {
|
||||
this.screen = screen;
|
||||
}
|
||||
|
||||
public float calcX(float value) {
|
||||
return screen.getWidth() * ((100/X) * value) / 100;
|
||||
}
|
||||
|
||||
public float calcY(float value) {
|
||||
return screen.getHeight() * ((100/Y) * value) / 100;
|
||||
}
|
||||
}
|
||||
@ -25,4 +25,5 @@ public class UserDataKeys {
|
||||
public static final String HITTED = "isHitted";
|
||||
public static final String SHOOTING = "isShooting";
|
||||
public static final String RUNNING = "isRunning";
|
||||
public static final String POINTS = "points";
|
||||
}
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (C) 2013 Rappold <http://wyrez.org> and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.wyrez.shootingstars.io;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rappold
|
||||
*/
|
||||
import java.io.File;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class SQLiteConnector {
|
||||
|
||||
private static final String DB_PATH = "scoresdb.db";
|
||||
|
||||
public SQLiteConnector() {
|
||||
}
|
||||
|
||||
public Connection initDBConnection() {
|
||||
Connection connection = null;
|
||||
boolean newFile = false;
|
||||
try {
|
||||
Class.forName("org.sqlite.JDBC");
|
||||
|
||||
String sqliteTable = "CREATE TABLE Scores (Name VARCHAR(250), Points INT(20), SongName VARCHAR(250))";
|
||||
File sQLiteDb = new File(DB_PATH);
|
||||
if (!sQLiteDb.exists()) {
|
||||
sQLiteDb.createNewFile();
|
||||
newFile = true;
|
||||
}
|
||||
|
||||
connection = DriverManager.getConnection("jdbc:sqlite:" + DB_PATH);
|
||||
|
||||
if(newFile) {
|
||||
Statement stmt = connection.createStatement();
|
||||
stmt.executeUpdate(sqliteTable);
|
||||
}
|
||||
return connection;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ResultSet excecuteQuery(Connection con, String query) {
|
||||
ResultSet result = null;
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
result = stmt.executeQuery(query);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int excecuteUpdate(Connection con, String query) {
|
||||
int result = 0;
|
||||
try {
|
||||
Statement stmt = con.createStatement();
|
||||
result = stmt.executeUpdate(query);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,7 @@ import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.gui.FileMetaInfoGUI;
|
||||
import org.wyrez.shootingstars.gui.Gui;
|
||||
import org.wyrez.shootingstars.gui.listener.FileMetaInfoListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
@ -34,10 +35,10 @@ public class FileMetaInfoState extends AbstractAppState implements FileMetaInfoL
|
||||
private GameSettings settings;
|
||||
private Gui gui;
|
||||
|
||||
public FileMetaInfoState(Screen screen, StateManager stateManager, GameSettings settings) {
|
||||
public FileMetaInfoState(Screen screen, StateManager stateManager, GameSettings settings, ScreenHelper screenHelper) {
|
||||
this.stateManager = stateManager;
|
||||
this.settings = settings;
|
||||
this.gui = new FileMetaInfoGUI(screen, this, settings);
|
||||
this.gui = new FileMetaInfoGUI(screen, this, settings, screenHelper);
|
||||
}
|
||||
|
||||
public void startLoading() {
|
||||
|
||||
@ -44,6 +44,7 @@ import org.wyrez.shootingstars.game.Ground;
|
||||
import org.wyrez.shootingstars.game.Player;
|
||||
import org.wyrez.shootingstars.gui.GameGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.GameListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import org.wyrez.shootingstars.helper.UserDataKeys;
|
||||
import tonegod.gui.core.Screen;
|
||||
import uk.co.caprica.vlcj.player.MediaPlayerFactory;
|
||||
@ -73,10 +74,10 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
|
||||
|
||||
public GameState(Node rootNode, Screen screen, StateManager stateManager,
|
||||
AssetManager assetManager, ViewPort viewPort,
|
||||
InputManager inputManager, Camera camera, AudioDataManager audioDataManager, GameSettings settings) {
|
||||
InputManager inputManager, Camera camera, AudioDataManager audioDataManager, GameSettings settings, ScreenHelper screenHelper) {
|
||||
|
||||
this.rootNode = rootNode;
|
||||
this.gui = new GameGUI(screen, this, assetManager);
|
||||
this.gui = new GameGUI(screen, this, assetManager,screenHelper);
|
||||
this.stateManager = stateManager;
|
||||
inputManager.addListener(this, new String[]{"ESC"});
|
||||
|
||||
@ -113,6 +114,8 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
|
||||
public void loadPlayer() {
|
||||
player = new Player(rootNode, stateManager, assetManager, viewPort, gui,
|
||||
inputManager, camera, audioDataManager);
|
||||
|
||||
gui.setPlayer(player);
|
||||
}
|
||||
|
||||
private void setRunning(boolean running) {
|
||||
|
||||
@ -21,6 +21,8 @@ import com.jme3.app.state.AppStateManager;
|
||||
import org.wyrez.shootingstars.gui.Gui;
|
||||
import org.wyrez.shootingstars.gui.HighscoreGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.HighscoreListener;
|
||||
import org.wyrez.shootingstars.gui.manager.HighscoreManager;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
@ -30,11 +32,13 @@ import tonegod.gui.core.Screen;
|
||||
public class HighscoreState extends AbstractAppState implements HighscoreListener{
|
||||
|
||||
private StateManager stateManager;
|
||||
private HighscoreManager highscoreManager;
|
||||
private Gui gui;
|
||||
|
||||
public HighscoreState(Screen screen, StateManager stateManager) {
|
||||
public HighscoreState(Screen screen, StateManager stateManager, HighscoreManager highscoreManager, ScreenHelper screenHelper) {
|
||||
this.stateManager = stateManager;
|
||||
this.gui = new HighscoreGUI(screen, this);
|
||||
this.highscoreManager = highscoreManager;
|
||||
this.gui = new HighscoreGUI(screen, this, highscoreManager,screenHelper);
|
||||
}
|
||||
|
||||
public void back() {
|
||||
|
||||
@ -25,6 +25,7 @@ import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.gui.LoadingGui;
|
||||
import org.wyrez.shootingstars.helper.ChecksumHelper;
|
||||
import org.wyrez.shootingstars.helper.PathHelper;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import org.wyrez.shootingstars.states.util.LoadingProgress;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
@ -41,9 +42,9 @@ public class LoadingState extends AbstractAppState {
|
||||
private GameSettings settings;
|
||||
|
||||
public LoadingState(Screen screen, StateManager stateManager,
|
||||
AudioDataManager audioDataManager, GameSettings settings) {
|
||||
AudioDataManager audioDataManager, GameSettings settings, ScreenHelper screenHelper) {
|
||||
this.stateManager = stateManager;
|
||||
this.gui = new LoadingGui(screen);
|
||||
this.gui = new LoadingGui(screen,screenHelper);
|
||||
this.audioDataManager = audioDataManager;
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ import org.wyrez.shootingstars.ShootingStars;
|
||||
import org.wyrez.shootingstars.gui.Gui;
|
||||
import org.wyrez.shootingstars.gui.MenuGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.MenuListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
@ -34,9 +35,9 @@ public class MenuState extends AbstractAppState implements MenuListener {
|
||||
private Gui gui;
|
||||
private ShootingStars shootingStars;
|
||||
|
||||
public MenuState(Screen screen, StateManager stateManager, ShootingStars shootingStars) {
|
||||
public MenuState(Screen screen, StateManager stateManager, ShootingStars shootingStars, ScreenHelper screenHelper) {
|
||||
this.stateManager = stateManager;
|
||||
this.gui = new MenuGUI(screen, this);
|
||||
this.gui = new MenuGUI(screen, this, screenHelper);
|
||||
this.shootingStars = shootingStars;
|
||||
}
|
||||
|
||||
|
||||
@ -20,6 +20,7 @@ import com.jme3.app.state.AbstractAppState;
|
||||
import com.jme3.app.state.AppStateManager;
|
||||
import org.wyrez.shootingstars.gui.OptionsGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.OptionsListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import org.wyrez.shootingstars.states.util.OptionSettings;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
@ -33,10 +34,10 @@ public class OptionsState extends AbstractAppState implements OptionsListener {
|
||||
private OptionsGUI gui;
|
||||
private OptionSettings settings;
|
||||
|
||||
public OptionsState(Screen screen, StateManager stateManager, OptionSettings settings) {
|
||||
public OptionsState(Screen screen, StateManager stateManager, OptionSettings settings, ScreenHelper screenHelper) {
|
||||
this.stateManager = stateManager;
|
||||
this.settings = settings;
|
||||
this.gui = new OptionsGUI(screen, this,settings);
|
||||
this.gui = new OptionsGUI(screen, this,settings, screenHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -23,6 +23,7 @@ import javax.swing.JFileChooser;
|
||||
import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.gui.SelectTrackGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.SelectFileListener;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
@ -35,10 +36,10 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
|
||||
private GameSettings settings;
|
||||
private SelectTrackGUI gui;
|
||||
|
||||
public SelectTrackState(Screen screen, StateManager stateManager, GameSettings settings) {
|
||||
public SelectTrackState(Screen screen, StateManager stateManager, GameSettings settings, ScreenHelper screenHelper) {
|
||||
this.stateManager = stateManager;
|
||||
this.settings = settings;
|
||||
this.gui = new SelectTrackGUI(screen, this);
|
||||
this.gui = new SelectTrackGUI(screen, this,screenHelper);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -26,6 +26,7 @@ import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.gui.YTDownloadGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.YTDownloadListener;
|
||||
import org.wyrez.shootingstars.helper.PathHelper;
|
||||
import org.wyrez.shootingstars.helper.ScreenHelper;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
@ -42,10 +43,10 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
|
||||
private YTDownloader downloader;
|
||||
|
||||
public YTDownloadState(Screen screen, StateManager stateManager,
|
||||
GameSettings settings, YTDownloader downloader) {
|
||||
GameSettings settings, YTDownloader downloader, ScreenHelper screenHelper) {
|
||||
this.stateManager = stateManager;
|
||||
this.settings = settings;
|
||||
this.gui = new YTDownloadGUI(screen, this);
|
||||
this.gui = new YTDownloadGUI(screen, this,screenHelper);
|
||||
this.downloader = downloader;
|
||||
}
|
||||
|
||||
@ -94,4 +95,8 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
stateManager.setState(State.MENU);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user