merged
This commit is contained in:
commit
6c393ef77a
BIN
ShootingStars/assets/Textures/Crosshair.png
Normal file
BIN
ShootingStars/assets/Textures/Crosshair.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
66
ShootingStars/jaudiotagger.LICENSE
Normal file
66
ShootingStars/jaudiotagger.LICENSE
Normal file
@ -0,0 +1,66 @@
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below.
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, “this License” refers to version 3 of the GNU Lesser General Public License, and the “GNU GPL” refers to version 3 of the GNU General Public License.
|
||||
|
||||
“The Library” refers to a covered work governed by this License, other than an Application or a Combined Work as defined below.
|
||||
|
||||
An “Application” is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library.
|
||||
|
||||
A “Combined Work” is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the “Linked Version”.
|
||||
|
||||
The “Minimal Corresponding Source” for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version.
|
||||
|
||||
The “Corresponding Application Code” for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work.
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL.
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or
|
||||
b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License.
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License.
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license document.
|
||||
c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document.
|
||||
d) Do one of the following:
|
||||
0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.
|
||||
1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version.
|
||||
e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License.
|
||||
b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library.
|
||||
BIN
ShootingStars/lib/jaudiotagger-2.2.0.jar
Normal file
BIN
ShootingStars/lib/jaudiotagger-2.2.0.jar
Normal file
Binary file not shown.
@ -32,6 +32,7 @@ dist.javadoc.dir=${dist.dir}/javadoc
|
||||
endorsed.classpath=
|
||||
excludes=
|
||||
file.reference.AudioProcessing-1.0.jar=lib\\AudioProcessing-1.0.jar
|
||||
file.reference.jaudiotagger-2.2.0.jar=lib\\jaudiotagger-2.2.0.jar
|
||||
file.reference.jl1.0.1.jar=lib\\jl1.0.1.jar
|
||||
file.reference.jna-3.5.2.jar=lib\\jna-3.5.2.jar
|
||||
file.reference.mp3spi1.9.5.jar=lib\\mp3spi1.9.5.jar
|
||||
@ -55,7 +56,8 @@ javac.classpath=\
|
||||
${file.reference.tritonus_aos-0.3.6.jar}:\
|
||||
${file.reference.tritonus_share-0.3.6.jar}:\
|
||||
${file.reference.AudioProcessing-1.0.jar}:\
|
||||
${libs.jme3-libraries-effects.classpath}
|
||||
${libs.jme3-libraries-effects.classpath}:\
|
||||
${file.reference.jaudiotagger-2.2.0.jar}
|
||||
# Space-separated list of extra javac options
|
||||
javac.compilerargs=
|
||||
javac.deprecation=false
|
||||
|
||||
24
ShootingStars/shootingstars.conf
Normal file
24
ShootingStars/shootingstars.conf
Normal file
@ -0,0 +1,24 @@
|
||||
#jME3 AppSettings
|
||||
#Fri Jun 14 08:27:23 CEST 2013
|
||||
Renderer(string)=LWJGL-OpenGL2
|
||||
Width(int)=1360
|
||||
DisableJoysticks(bool)=true
|
||||
SettingsDialogImage(string)=
|
||||
Title(string)=Shooting Stars
|
||||
Height(int)=768
|
||||
MasterVolume(int)=49
|
||||
ParticleDensity(int)=3
|
||||
Samples(int)=0
|
||||
UseInput(bool)=true
|
||||
BitsPerPixel(int)=24
|
||||
Frequency(int)=60
|
||||
Username(string)=Chris
|
||||
DepthBits(int)=32
|
||||
FXVolume(int)=85
|
||||
Fullscreen(bool)=false
|
||||
AudioRenderer(string)=LWJGL
|
||||
StencilBits(int)=0
|
||||
PostProcessing(bool)=false
|
||||
VSync(bool)=true
|
||||
FrameRate(int)=-1
|
||||
SoundVolume(int)=24
|
||||
@ -23,14 +23,19 @@ import com.jme3.app.StatsAppState;
|
||||
import com.jme3.app.state.AppStateManager;
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.input.InputManager;
|
||||
import com.jme3.input.KeyInput;
|
||||
import com.jme3.input.controls.KeyTrigger;
|
||||
import com.jme3.renderer.Camera;
|
||||
import com.jme3.renderer.ViewPort;
|
||||
import com.jme3.scene.Node;
|
||||
import org.wyrez.persij.PersiJContainer;
|
||||
import org.wyrez.shootingstars.audiodata.AudioDataManager;
|
||||
import org.wyrez.shootingstars.factories.Materials;
|
||||
import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.states.GameState;
|
||||
import org.wyrez.shootingstars.states.State;
|
||||
import org.wyrez.shootingstars.states.StateManager;
|
||||
import org.wyrez.shootingstars.states.util.OptionSettings;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
@ -42,9 +47,13 @@ public class ShootingStars extends SimpleApplication {
|
||||
private PersiJContainer container;
|
||||
private StateManager sManager;
|
||||
private Screen screen;
|
||||
private OptionSettings optionSettings;
|
||||
private GameSettings gameSettings;
|
||||
|
||||
public ShootingStars() {
|
||||
super(new StatsAppState(), new DebugKeysAppState());
|
||||
optionSettings = new OptionSettings();
|
||||
gameSettings = new GameSettings();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,6 +61,8 @@ public class ShootingStars extends SimpleApplication {
|
||||
System.setProperty("jna.library.path", "lib/vlc");
|
||||
registerTypes();
|
||||
initGUI();
|
||||
initKeys();
|
||||
initSettings();
|
||||
|
||||
Materials.initialize(assetManager);
|
||||
cam.setFrustumFar(2500f);
|
||||
@ -76,13 +87,35 @@ public class ShootingStars extends SimpleApplication {
|
||||
container.registerSingleton(InputManager.class, inputManager);
|
||||
container.registerSingleton(AssetManager.class, assetManager);
|
||||
container.registerSingleton(ViewPort.class, viewPort);
|
||||
container.registerSingleton(OptionSettings.class, optionSettings);
|
||||
container.registerSingleton(GameSettings.class, gameSettings);
|
||||
container.registerType(StateManager.class, true);
|
||||
container.registerType(Screen.class, true);
|
||||
container.registerType(AudioDataManager.class, true);
|
||||
container.registerType(AudioDataManager.class, true);
|
||||
}
|
||||
|
||||
private void initKeys() {
|
||||
inputManager.addMapping("Pause", new KeyTrigger(KeyInput.KEY_P));
|
||||
inputManager.deleteMapping(INPUT_MAPPING_EXIT);
|
||||
inputManager.addMapping("ESC", new KeyTrigger(KeyInput.KEY_ESCAPE));
|
||||
|
||||
}
|
||||
|
||||
private void initSettings() {
|
||||
if(optionSettings.saveExists()) {
|
||||
optionSettings.init(false);
|
||||
optionSettings.load();
|
||||
} else {
|
||||
optionSettings.init(true);
|
||||
optionSettings.save();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
ShootingStars app = new ShootingStars();
|
||||
|
||||
//app.setSettings(optionSettings);
|
||||
|
||||
app.start();
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import com.jme3.input.controls.KeyTrigger;
|
||||
import com.jme3.input.controls.MouseButtonTrigger;
|
||||
import com.jme3.scene.Spatial;
|
||||
import com.jme3.scene.control.Control;
|
||||
import org.wyrez.shootingstars.gui.GameGUI;
|
||||
import org.wyrez.shootingstars.helper.UserDataKeys;
|
||||
|
||||
/**
|
||||
@ -36,11 +37,13 @@ public class PlayerShootControl extends BaseControl implements ActionListener {
|
||||
private static final float maxTimeToOverheat = 3f;
|
||||
/**/
|
||||
private InputManager inputManager;
|
||||
private GameGUI gui;
|
||||
private float timeToOverheat = maxTimeToOverheat;
|
||||
private boolean isShooting = false;
|
||||
|
||||
public PlayerShootControl(InputManager inputmanager) {
|
||||
public PlayerShootControl(InputManager inputmanager, GameGUI gui) {
|
||||
this.inputManager = inputmanager;
|
||||
this.gui = gui;
|
||||
initMappings();
|
||||
}
|
||||
|
||||
@ -67,7 +70,7 @@ public class PlayerShootControl extends BaseControl implements ActionListener {
|
||||
}
|
||||
|
||||
public Control cloneForSpatial(Spatial spatial) {
|
||||
PlayerShootControl control = new PlayerShootControl(inputManager);
|
||||
PlayerShootControl control = new PlayerShootControl(inputManager, gui);
|
||||
spatial.addControl(control);
|
||||
return control;
|
||||
}
|
||||
|
||||
@ -34,15 +34,25 @@ public class GameSettings {
|
||||
private String videoFile;
|
||||
private boolean useVideo;
|
||||
|
||||
public GameSettings(String audioFile, String videoFile) {
|
||||
public GameSettings() {
|
||||
// this.audioFile = audioFile;
|
||||
// if (videoFile == null) {
|
||||
// videoFile = audioFile;
|
||||
// useVideo = false;
|
||||
// } else {
|
||||
// this.videoFile = videoFile;
|
||||
// useVideo = true;
|
||||
// }
|
||||
}
|
||||
|
||||
public void setAudioFile(String audioFile) {
|
||||
this.audioFile = audioFile;
|
||||
if (videoFile == null) {
|
||||
videoFile = audioFile;
|
||||
useVideo = false;
|
||||
} else {
|
||||
this.videoFile = videoFile;
|
||||
useVideo = true;
|
||||
}
|
||||
this.useVideo = false;
|
||||
}
|
||||
|
||||
public void setVideoFile(String videoFile) {
|
||||
this.videoFile = videoFile;
|
||||
this.useVideo = true;
|
||||
}
|
||||
|
||||
public String getAudioFile() {
|
||||
|
||||
@ -0,0 +1,126 @@
|
||||
package org.wyrez.shootingstars.gui;
|
||||
|
||||
import com.jme3.input.event.MouseButtonEvent;
|
||||
import com.jme3.math.Vector2f;
|
||||
import java.io.File;
|
||||
import org.jaudiotagger.audio.AudioFile;
|
||||
import org.jaudiotagger.audio.AudioFileIO;
|
||||
import org.jaudiotagger.audio.AudioHeader;
|
||||
import org.jaudiotagger.tag.FieldKey;
|
||||
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 tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class FileMetaInfoGUI extends Panel implements Gui {
|
||||
|
||||
private FileMetaInfoListener listener;
|
||||
private GameSettings settings;
|
||||
private String duration = "Test";
|
||||
private String title = "Test2";
|
||||
private String artist = "Test3";
|
||||
|
||||
public FileMetaInfoGUI(Screen screen, FileMetaInfoListener listener, GameSettings settings) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f));
|
||||
this.listener = listener;
|
||||
this.settings = settings;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float startPointx = 256f;
|
||||
float startPointy = 252f;
|
||||
float marginLeft = 110f;
|
||||
float buttonWidth = 153.6f;
|
||||
|
||||
File file = null;
|
||||
if(settings.useVideo()) {
|
||||
file = new File(settings.getVideoFile());
|
||||
} else {
|
||||
file = new File(settings.getAudioFile());
|
||||
}
|
||||
|
||||
readMetaData(file);
|
||||
|
||||
Label lblArtistHead = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(100f, 40f));
|
||||
lblArtistHead.setText("Artist");
|
||||
|
||||
Label lblArtist = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy), new Vector2f(400f, 40f));
|
||||
lblArtist.setText(artist);
|
||||
|
||||
Label lblTitelHead = new Label(screen, new Vector2f(startPointx, startPointy + 50f), new Vector2f(100f, 40f));
|
||||
lblTitelHead.setText("Titel");
|
||||
|
||||
Label lblTitel = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 50f), new Vector2f(400f, 40f));
|
||||
lblTitel.setText(title);
|
||||
|
||||
Label lblDurationHead = new Label(screen, new Vector2f(startPointx, startPointy + 100f), new Vector2f(100f, 40f));
|
||||
lblDurationHead.setText("Duration");
|
||||
|
||||
Label lblDuration = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 100f), new Vector2f(400f, 40f));
|
||||
lblDuration.setText(duration);
|
||||
|
||||
Button btnStartLoading = new ButtonBase(screen, new Vector2f(startPointx + 500f, startPointy + 400f), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.startLoading();
|
||||
}
|
||||
};
|
||||
btnStartLoading.setText("Start Loading");
|
||||
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx + 750f, startPointy + 400f), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancel();
|
||||
}
|
||||
};
|
||||
btnCancel.setText("Cancel");
|
||||
|
||||
this.addChild(lblArtistHead);
|
||||
this.addChild(lblArtist);
|
||||
this.addChild(lblTitelHead);
|
||||
this.addChild(lblTitel);
|
||||
this.addChild(lblDurationHead);
|
||||
this.addChild(lblDuration);
|
||||
this.addChild(btnStartLoading);
|
||||
this.addChild(btnCancel);
|
||||
}
|
||||
|
||||
private void readMetaData(File file) {
|
||||
try {
|
||||
AudioFile f = AudioFileIO.read(file);
|
||||
Tag tag = f.getTag();
|
||||
AudioHeader ah = f.getAudioHeader();
|
||||
|
||||
if (ah != null) {
|
||||
duration = String.valueOf(ah.getTrackLength());
|
||||
}
|
||||
|
||||
if (tag != null) {
|
||||
if (tag.hasField(FieldKey.TITLE)) {
|
||||
title = tag.getFirst(FieldKey.TITLE);
|
||||
}
|
||||
artist = tag.getFirst(FieldKey.ARTIST);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
screen.addElement(this);
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
screen.removeElement(this);
|
||||
}
|
||||
}
|
||||
@ -16,9 +16,12 @@
|
||||
*/
|
||||
package org.wyrez.shootingstars.gui;
|
||||
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.font.BitmapFont;
|
||||
import com.jme3.input.event.MouseButtonEvent;
|
||||
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.listener.GameListener;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
@ -33,10 +36,15 @@ public class GameGUI extends Panel {
|
||||
|
||||
private GameListener listener;
|
||||
private Button btnStart;
|
||||
private Button btnResume;
|
||||
private Button btnMenu;
|
||||
private Picture picCrosshair;
|
||||
private AssetManager assetManager;
|
||||
|
||||
public GameGUI(Screen screen, GameListener listener) {
|
||||
public GameGUI(Screen screen, GameListener listener, AssetManager assetManager) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.assetManager = assetManager;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
@ -44,8 +52,13 @@ public class GameGUI extends Panel {
|
||||
|
||||
private void create() {
|
||||
|
||||
float startPointx = screen.getWidth() * 0.42f;
|
||||
float startPointy = screen.getHeight() * 0.80f;
|
||||
float startPointx = 537f;
|
||||
float startPointy = 576f;
|
||||
|
||||
float startPointCrosshairx = 441f;
|
||||
float startPointCrosshairy = 560f;
|
||||
|
||||
float startPointYMenu = 200f;
|
||||
|
||||
btnStart = new ButtonBase(screen, new Vector2f(startPointx, startPointy),
|
||||
new Vector2f(200f, 30f)) {
|
||||
@ -57,15 +70,74 @@ public class GameGUI extends Panel {
|
||||
btnStart.setText("Launch");
|
||||
btnStart.setTextAlign(BitmapFont.Align.Center);
|
||||
|
||||
btnResume = new ButtonBase(screen, new Vector2f(startPointx, startPointYMenu),
|
||||
new Vector2f(200f, 30f)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.resume();
|
||||
}
|
||||
};
|
||||
btnResume.setText("Resume");
|
||||
btnResume.setTextAlign(BitmapFont.Align.Center);
|
||||
|
||||
btnMenu = new ButtonBase(screen, new Vector2f(startPointx, startPointYMenu + 40f),
|
||||
new Vector2f(200f, 30f)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancelTrack();
|
||||
}
|
||||
};
|
||||
btnMenu.setText("Menu");
|
||||
btnMenu.setTextAlign(BitmapFont.Align.Center);
|
||||
|
||||
picCrosshair = new Picture("Crosshair");
|
||||
picCrosshair.setWidth(400f);
|
||||
picCrosshair.setHeight(400f);
|
||||
picCrosshair.setImage(assetManager, "Textures/Crosshair.png", true);
|
||||
|
||||
|
||||
|
||||
Panel plnCrosshair = new Panel(screen, new Vector2f(startPointCrosshairx, startPointCrosshairy), new Vector2f(0f, 0f));
|
||||
plnCrosshair.setIsVisible(false);
|
||||
plnCrosshair.setIgnoreMouse(true);
|
||||
plnCrosshair.attachChild(picCrosshair);
|
||||
|
||||
this.addChild(btnStart);
|
||||
this.addChild(btnResume);
|
||||
this.addChild(btnMenu);
|
||||
this.addChild(plnCrosshair);
|
||||
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
}
|
||||
|
||||
public void setStart() {
|
||||
btnStart.hide();
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Inherit);
|
||||
}
|
||||
|
||||
public void setWait() {
|
||||
btnStart.show();
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
}
|
||||
|
||||
public void showMenu() {
|
||||
btnStart.hide();
|
||||
btnResume.show();
|
||||
btnMenu.show();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
}
|
||||
|
||||
public void resumeGame() {
|
||||
btnStart.hide();
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Inherit);
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
@ -75,4 +147,8 @@ public class GameGUI extends Panel {
|
||||
public void detach() {
|
||||
screen.removeElement(this);
|
||||
}
|
||||
|
||||
public void updateOverhead(float percent) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
121
ShootingStars/src/org/wyrez/shootingstars/gui/HighscoreGUI.java
Normal file
121
ShootingStars/src/org/wyrez/shootingstars/gui/HighscoreGUI.java
Normal file
@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
import com.jme3.input.event.MouseButtonEvent;
|
||||
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.model.Score;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class HighscoreGUI extends Panel implements Gui {
|
||||
|
||||
private HighscoreListener listener;
|
||||
//private HighscoreManager highscoreManager;
|
||||
|
||||
public HighscoreGUI(Screen screen, HighscoreListener listener) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f));
|
||||
this.listener = listener;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
//highscoreManager = new HighscoreManager();
|
||||
create();
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
screen.addElement(this);
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
screen.removeElement(this);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float startPointx = 32f;
|
||||
float startPointy = 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 = 14f;
|
||||
float marginScorePointsLeft = 300f;
|
||||
float marginScoreSongNameLeft = 600f;
|
||||
|
||||
float marginScoreTop = 50f;
|
||||
|
||||
//List<Score> highscores = highscoreManager.getScores();
|
||||
|
||||
Label lblScoreNameHead = new Label(screen, new Vector2f(startPointx + marginScoreNameLeft, startPointy), new Vector2f(250f, 40f));
|
||||
lblScoreNameHead.setText("Name");
|
||||
|
||||
Label lblScorePointsHead = new Label(screen, new Vector2f(startPointx + marginScorePointsLeft, startPointy), new Vector2f(250f, 40f));
|
||||
lblScorePointsHead.setText("Points");
|
||||
|
||||
Label lblScoreSongNameHead = new Label(screen, new Vector2f(startPointx + marginScoreSongNameLeft, startPointy), new Vector2f(600f, 40f));
|
||||
lblScoreSongNameHead.setText("Song Name");
|
||||
|
||||
// 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;
|
||||
// }
|
||||
|
||||
Button btnBack = new ButtonBase(screen, new Vector2f(startPointx + 1000f, startPointy + 610f), new Vector2f(153f, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.back();
|
||||
}
|
||||
};
|
||||
btnBack.setText("Back");
|
||||
|
||||
this.addChild(lblScoreNameHead);
|
||||
this.addChild(lblScorePointsHead);
|
||||
this.addChild(lblScoreSongNameHead);
|
||||
this.addChild(btnBack);
|
||||
}
|
||||
}
|
||||
@ -44,8 +44,9 @@ public class LoadingGui extends Panel {
|
||||
|
||||
private void create() {
|
||||
|
||||
float startPointx = screen.getWidth() * 0.42f;
|
||||
float startPointy = screen.getHeight() * 0.80f;
|
||||
float startPointx = 537f;//screen.getWidth() * 0.42f;
|
||||
float startPointy = 576f;//screen.getHeight() * 0.80f;
|
||||
float distancePogressbarLabely = 36f;
|
||||
|
||||
indProgress = new IndicatorBase(screen, new Vector2f(startPointx, startPointy),
|
||||
new Vector2f(200f, 30f), Indicator.Orientation.HORIZONTAL);
|
||||
@ -53,7 +54,7 @@ public class LoadingGui extends Panel {
|
||||
indProgress.setMaxValue(LoadingProgress.getProgressCount());
|
||||
indProgress.setIndicatorColor(ColorRGBA.Black);
|
||||
|
||||
lblStatus = new Label(screen, new Vector2f(startPointx, startPointy + (screen.getHeight() * 0.05f)), new Vector2f(200f, 30f));
|
||||
lblStatus = new Label(screen, new Vector2f(startPointx, startPointy + distancePogressbarLabely), new Vector2f(200f, 30f));
|
||||
lblStatus.setTextAlign(BitmapFont.Align.Center);
|
||||
|
||||
this.addChild(indProgress);
|
||||
|
||||
@ -37,34 +37,55 @@ public class MenuGUI extends Panel implements Gui {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
|
||||
float startPointx = screen.getWidth() * 0.2f;
|
||||
float startPointy = screen.getHeight() * 0.35f;
|
||||
float labelFontSize = screen.getWidth() * 0.07f;
|
||||
float buttonLabelDistancex = screen.getWidth() * 0.5f;
|
||||
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;
|
||||
|
||||
Label lblWyrez = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(300, 40));
|
||||
lblWyrez.setFontSize(labelFontSize);
|
||||
lblWyrez.setText("Wyrez");
|
||||
|
||||
Label lblShootingStars = new Label(screen, new Vector2f(startPointx, startPointy + (screen.getHeight() * 0.1f)), new Vector2f(500, 40));
|
||||
Label lblShootingStars = new Label(screen, new Vector2f(startPointx, startPointy + distanceLabelLabely), new Vector2f(500, 40));
|
||||
lblShootingStars.setFontSize(labelFontSize);
|
||||
lblShootingStars.setText("Shooting Stars");
|
||||
|
||||
Button btnStart = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + (screen.getHeight() * 0.03f)), new Vector2f(160, 40)) {
|
||||
Button btnStart = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + marginButtonTop), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.startGame();
|
||||
listener.selectFile();
|
||||
}
|
||||
};
|
||||
btnStart.setText("Start Game");
|
||||
|
||||
Button btnExit = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + (screen.getHeight() * 0.125f)), new Vector2f(160, 40)) {
|
||||
Button btnHighscore = new ButtonBase(screen, new Vector2f(startPointx + buttonButtonDistancex, startPointy + marginButtonTop), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.openhighscore();
|
||||
}
|
||||
};
|
||||
btnHighscore.setText("Highscore");
|
||||
|
||||
Button btnOptions = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + buttonButtonDistancey), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.openOptions();
|
||||
}
|
||||
};
|
||||
btnOptions.setText("Options");
|
||||
|
||||
Button btnExit = new ButtonBase(screen, new Vector2f(startPointx + buttonButtonDistancex, startPointy + buttonButtonDistancey), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.exitGame();
|
||||
@ -73,6 +94,8 @@ public class MenuGUI extends Panel implements Gui {
|
||||
btnExit.setText("Exit Game");
|
||||
|
||||
this.addChild(btnStart);
|
||||
this.addChild(btnHighscore);
|
||||
this.addChild(btnOptions);
|
||||
this.addChild(btnExit);
|
||||
this.addChild(lblWyrez);
|
||||
this.addChild(lblShootingStars);
|
||||
|
||||
310
ShootingStars/src/org/wyrez/shootingstars/gui/OptionsGUI.java
Normal file
310
ShootingStars/src/org/wyrez/shootingstars/gui/OptionsGUI.java
Normal file
@ -0,0 +1,310 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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.helper.DisplayHelper;
|
||||
import org.wyrez.shootingstars.states.util.OptionSettings;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.buttons.CheckBox;
|
||||
import tonegod.gui.controls.lists.ComboBox;
|
||||
import tonegod.gui.controls.lists.Slider;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.text.TextField;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
import tonegod.gui.controls.windows.TabControl;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class OptionsGUI extends Panel implements Gui {
|
||||
|
||||
private OptionsListener listener;
|
||||
private OptionSettings settings;
|
||||
//General Controls
|
||||
private TextField txtPlayerName;
|
||||
|
||||
//Video Controls
|
||||
private ComboBox cboResolution;
|
||||
private ComboBox cboFrequency;
|
||||
private ComboBox cboDepthBits;
|
||||
private CheckBox chkFullscreen;
|
||||
private CheckBox chkVSync;
|
||||
private CheckBox chkPostProcessing;
|
||||
private Slider sldParticleDensity;
|
||||
//Audio Controls
|
||||
private Slider sldMasterVolume;
|
||||
private Slider sldFXVolume;
|
||||
private Slider sldSoundVolume;
|
||||
|
||||
public OptionsGUI(Screen screen, OptionsListener listener, OptionSettings settings) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.settings = settings;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
readControlValues();
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
screen.addElement(this);
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
screen.removeElement(this);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float tabControlStartPointx = 32f;
|
||||
float tabControlStartPointy = 18f;
|
||||
float witdhTabControl = 1216f;
|
||||
float heightTabControl = 612f;
|
||||
|
||||
float buttonWidth = 153.6f;
|
||||
|
||||
TabControl tcOptions = new TabControl(screen, "tcOptions", new Vector2f(tabControlStartPointx, tabControlStartPointy), new Vector2f(witdhTabControl, heightTabControl));
|
||||
tcOptions.setUseSlideEffect(true);
|
||||
tcOptions.addTab("General");
|
||||
tcOptions.addTab("Video");
|
||||
tcOptions.addTab("Audio");
|
||||
|
||||
createGeneralTab(tcOptions);
|
||||
createVideoTab(tcOptions);
|
||||
createAudioTab(tcOptions);
|
||||
|
||||
float differnceTabControlButtons = 622.8f;
|
||||
|
||||
Button btnSave = new ButtonBase(screen, new Vector2f(tabControlStartPointx + 877f, tabControlStartPointy + differnceTabControlButtons), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
saveControlValues();
|
||||
listener.save();
|
||||
}
|
||||
};
|
||||
btnSave.setText("Save");
|
||||
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(tabControlStartPointx + 1060f, tabControlStartPointy + differnceTabControlButtons), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancel();
|
||||
}
|
||||
};
|
||||
btnCancel.setText("Cancel");
|
||||
|
||||
this.addChild(tcOptions);
|
||||
this.addChild(btnSave);
|
||||
this.addChild(btnCancel);
|
||||
}
|
||||
|
||||
private void createGeneralTab(TabControl tcOptions) {
|
||||
float startPointx = 64f;
|
||||
float startPointy = 36f;
|
||||
float marginLeftControls = 115.8f;
|
||||
|
||||
Label lblPlayerName = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(120f, 40f));
|
||||
lblPlayerName.setText("PlayerName");
|
||||
|
||||
txtPlayerName = new TextField(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 7f), new Vector2f(200f, 30f));
|
||||
|
||||
tcOptions.addTabChild(0, lblPlayerName);
|
||||
tcOptions.addTabChild(0, txtPlayerName);
|
||||
}
|
||||
|
||||
private void createVideoTab(TabControl tcOptions) {
|
||||
|
||||
float startPointx = 64f;
|
||||
float startPointy = 36f;
|
||||
float marginLeftControls = 115.8f;
|
||||
|
||||
Label lblResolution = new Label(screen, "lblResolution", new Vector2f(startPointx, startPointy), new Vector2f(100f, 40f));
|
||||
lblResolution.setText("Resolution");
|
||||
|
||||
cboResolution = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 7f), new Vector2f(200f, 30f)) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
for (String s : DisplayHelper.getResolutions()) {
|
||||
cboResolution.addListItem(s, s);
|
||||
}
|
||||
|
||||
Label lblFrequency = new Label(screen, "lblFrequency", new Vector2f(startPointx, startPointy + 40f), new Vector2f(100f, 40f));
|
||||
lblFrequency.setText("Frequency");
|
||||
|
||||
cboFrequency = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 47f), new Vector2f(200f, 30f)) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
for (String s : DisplayHelper.getFrequencys()) {
|
||||
cboFrequency.addListItem(s, s);
|
||||
}
|
||||
|
||||
Label lblDepthBits = new Label(screen, "lblDepthBits", new Vector2f(startPointx, startPointy + 80f), new Vector2f(100f, 40f));
|
||||
lblDepthBits.setText("DepthBits");
|
||||
|
||||
cboDepthBits = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 87f), new Vector2f(200f, 30f)) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
for (String s : DisplayHelper.getDepthBits()) {
|
||||
cboDepthBits.addListItem(s, s);
|
||||
}
|
||||
|
||||
Label lblFullscreen = new Label(screen, "lblFullscreen", new Vector2f(startPointx, startPointy + 120f), new Vector2f(100f, 40f));
|
||||
lblFullscreen.setText("Fullscreen");
|
||||
|
||||
chkFullscreen = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 132f), new Vector2f(20f, 20f));
|
||||
|
||||
Label lblVSync = new Label(screen, "lblVSync", new Vector2f(startPointx, startPointy + 160f), new Vector2f(100f, 40f));
|
||||
lblVSync.setText("VSync");
|
||||
|
||||
chkVSync = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 172f), new Vector2f(20f, 20f));
|
||||
|
||||
Label lblPostProcessing = new Label(screen, "lblPostProcessing", new Vector2f(startPointx, startPointy + 200f), new Vector2f(120f, 40f));
|
||||
lblPostProcessing.setText("PostProcessing");
|
||||
|
||||
chkPostProcessing = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 212f), new Vector2f(20f, 20f));
|
||||
|
||||
Label lblParticleDensity = new Label(screen, "lblParticleDensity", new Vector2f(startPointx, startPointy + 240f), new Vector2f(120f, 40f));
|
||||
lblParticleDensity.setText("ParticleDensity");
|
||||
|
||||
sldParticleDensity = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 247f), new Vector2f(200f, 30f), 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, 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;
|
||||
|
||||
Label lblMasterVolume = new Label(screen, "lblMasterVolume", new Vector2f(startPointx, startPointy), new Vector2f(120f, 40f));
|
||||
lblMasterVolume.setText("MasterVolume");
|
||||
|
||||
sldMasterVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 7f), new Vector2f(200f, 30f), 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));
|
||||
lblFXVolume.setText("FXVolume");
|
||||
|
||||
sldFXVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 47f), new Vector2f(200f, 30f), 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));
|
||||
lblSoundVolume.setText("SoundVolume");
|
||||
|
||||
sldSoundVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + 87f), new Vector2f(200f, 30f), Slider.Orientation.HORIZONTAL, false) {
|
||||
@Override
|
||||
public void onChange(int selectedIndex, Object value) {
|
||||
}
|
||||
};
|
||||
sldSoundVolume.setStepIntegerRange(0, 100, 1);
|
||||
|
||||
tcOptions.addTabChild(2, lblMasterVolume);
|
||||
tcOptions.addTabChild(2, sldMasterVolume);
|
||||
tcOptions.addTabChild(2, lblFXVolume);
|
||||
tcOptions.addTabChild(2, sldFXVolume);
|
||||
tcOptions.addTabChild(2, lblSoundVolume);
|
||||
tcOptions.addTabChild(2, sldSoundVolume);
|
||||
}
|
||||
|
||||
private void readControlValues() {
|
||||
String resolution = String.valueOf(settings.getWidth()) + " x " + String.valueOf(settings.getHeight());
|
||||
|
||||
//General
|
||||
txtPlayerName.setText(settings.getUsername());
|
||||
|
||||
//Video
|
||||
setComboBoxValue(cboResolution, resolution);
|
||||
setComboBoxValue(cboFrequency, String.valueOf(settings.getFrequency()));
|
||||
setComboBoxValue(cboDepthBits, String.valueOf(settings.getDepthBits()));
|
||||
chkFullscreen.setIsChecked(settings.isFullscreenEnabled());
|
||||
chkVSync.setIsChecked(settings.isVSyncEnabled());
|
||||
chkPostProcessing.setIsChecked(settings.isPostprocessingEnabled());
|
||||
sldParticleDensity.setSelectedIndex(settings.getParticleDensity());
|
||||
|
||||
//Audio
|
||||
sldMasterVolume.setSelectedIndex(settings.getMasterVolume());
|
||||
sldFXVolume.setSelectedIndex(settings.getFXVolume());
|
||||
sldSoundVolume.setSelectedIndex(settings.getSoundVolume());
|
||||
}
|
||||
|
||||
private void setComboBoxValue(ComboBox comboBox, String value) {
|
||||
for (int i = 0; i < comboBox.getListItems().size(); i++) {
|
||||
if (comboBox.getListItems().get(i).getValue().equals(value)) {
|
||||
comboBox.setSelectedIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveControlValues() {
|
||||
//General
|
||||
settings.setUsername(txtPlayerName.getText());
|
||||
|
||||
//Video
|
||||
String resolution[] = cboResolution.getSelectedListItem().getValue().toString().split(" x ");
|
||||
settings.setWidth(Integer.parseInt(resolution[0]));
|
||||
settings.setHeight(Integer.parseInt(resolution[1]));
|
||||
settings.setFrequency(Integer.parseInt(cboFrequency.getSelectedListItem().getValue().toString()));
|
||||
settings.setDepthBits(Integer.parseInt(cboDepthBits.getSelectedListItem().getValue().toString()));
|
||||
settings.setFullscreen(chkFullscreen.getIsChecked());
|
||||
settings.setVSync(chkVSync.getIsChecked());
|
||||
settings.setPostProcessing(chkPostProcessing.getIsChecked());
|
||||
settings.setParticleDensity(sldParticleDensity.getSelectedIndex());
|
||||
|
||||
//Audio
|
||||
settings.setMasterVolume(sldMasterVolume.getSelectedIndex());
|
||||
settings.setFXVolume(sldFXVolume.getSelectedIndex());
|
||||
settings.setSoundVolume(sldSoundVolume.getSelectedIndex());
|
||||
|
||||
settings.save();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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 tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class SelectTrackGUI extends Panel implements Gui{
|
||||
|
||||
SelectFileListener listener;
|
||||
|
||||
public SelectTrackGUI(Screen screen, SelectFileListener listener) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
this.setIgnoreMouse(true);
|
||||
this.setIsVisible(false);
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
float startPointx = 576f;//screen.getWidth() * 0.45f;
|
||||
float startPointy = 324f;//screen.getHeight() * 0.45f;
|
||||
float labelFontSize = 76f;//screen.getWidth() * 0.06f;
|
||||
float buttonWidth = 153f;//screen.getWidth() * 0.12f;
|
||||
float marginLabelOrLeft = 45f;
|
||||
float marginLabelOrTop = 43f;
|
||||
float marginButtonYTDownloadTop = 129f;
|
||||
|
||||
Button btnSelectFile = new ButtonBase(screen, new Vector2f(startPointx, startPointy), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.selectFile();
|
||||
}
|
||||
};
|
||||
btnSelectFile.setText("Select File");
|
||||
|
||||
Label lblOr = new Label(screen, new Vector2f(startPointx + marginLabelOrLeft, startPointy + marginLabelOrTop), new Vector2f(100, 40));
|
||||
lblOr.setFontSize(labelFontSize);
|
||||
lblOr.setText("Or");
|
||||
|
||||
Button btnYTDownload = new ButtonBase(screen, new Vector2f(startPointx, startPointy + marginButtonYTDownloadTop), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.downloadYT();
|
||||
}
|
||||
};
|
||||
btnYTDownload.setText("YT Download");
|
||||
|
||||
this.addChild(btnSelectFile);
|
||||
this.addChild(lblOr);
|
||||
this.addChild(btnYTDownload);
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
screen.addElement(this);
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
screen.removeElement(this);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
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 tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.text.TextField;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class YTDownloadGUI extends Panel implements Gui{
|
||||
|
||||
private YTDownloadListener listener;
|
||||
|
||||
public YTDownloadGUI(Screen screen, YTDownloadListener listener) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
|
||||
this.listener = listener;
|
||||
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;
|
||||
|
||||
|
||||
Label lblYTLink = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(160, 40));
|
||||
lblYTLink.setFontSize(labelFontSize);
|
||||
lblYTLink.setText("YT Link");
|
||||
|
||||
final TextField txtYTLink = new TextField(screen,"txtYTLink", new Vector2f(startPointx + marginTextFieldLeft, startPointy + marginTextFieldTop), new Vector2f(textFieldWitdh, 40));
|
||||
txtYTLink.setType(TextField.Type.DEFAULT);
|
||||
|
||||
Button btnYTDownload = new ButtonBase(screen, new Vector2f(startPointx + marginYTButtonLeft, startPointy + marginYTButtonTop), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.downloadYTVideo(txtYTLink.getText());
|
||||
}
|
||||
};
|
||||
btnYTDownload.setText("Download");
|
||||
|
||||
this.addChild(lblYTLink);
|
||||
this.addChild(txtYTLink);
|
||||
this.addChild(btnYTDownload);
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
screen.addElement(this);
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
screen.removeElement(this);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package org.wyrez.shootingstars.gui.listener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public interface FileMetaInfoListener {
|
||||
public void startLoading();
|
||||
public void cancel();
|
||||
}
|
||||
@ -23,4 +23,8 @@ package org.wyrez.shootingstars.gui.listener;
|
||||
public interface GameListener {
|
||||
|
||||
public void start();
|
||||
|
||||
public void resume();
|
||||
|
||||
public void cancelTrack();
|
||||
}
|
||||
|
||||
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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.listener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public interface HighscoreListener {
|
||||
|
||||
public void back();
|
||||
|
||||
}
|
||||
@ -22,7 +22,13 @@ package org.wyrez.shootingstars.gui.listener;
|
||||
*/
|
||||
public interface MenuListener {
|
||||
|
||||
public void selectFile();
|
||||
|
||||
public void openhighscore();
|
||||
|
||||
public void openOptions();
|
||||
|
||||
public void exitGame();
|
||||
|
||||
public void startGame();
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.listener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public interface OptionsListener {
|
||||
|
||||
public void save();
|
||||
|
||||
public void cancel();
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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.listener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public interface SelectFileListener {
|
||||
|
||||
public void selectFile();
|
||||
|
||||
public void downloadYT();
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* 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.listener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public interface YTDownloadListener {
|
||||
|
||||
public void downloadYTVideo(String url);
|
||||
}
|
||||
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rappold
|
||||
*/
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Score implements Serializable {
|
||||
private int score;
|
||||
private String playerName;
|
||||
private String songName;
|
||||
|
||||
public void setSongName(String songName) {
|
||||
this.songName = songName;
|
||||
}
|
||||
|
||||
public void setPlayerName(String playerName) {
|
||||
this.playerName = playerName;
|
||||
}
|
||||
|
||||
public void setScore(int score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public String getPlayerName() {
|
||||
return playerName;
|
||||
}
|
||||
|
||||
public String getSongName(){
|
||||
return songName;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public Score(String songName, String playerName, int score) {
|
||||
this.songName = songName;
|
||||
this.score = score;
|
||||
this.playerName = playerName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.helper;
|
||||
|
||||
import java.awt.DisplayMode;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class DisplayHelper {
|
||||
|
||||
public static List<String> getResolutions() {
|
||||
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);
|
||||
}
|
||||
}
|
||||
Collections.sort(resolutions);
|
||||
return resolutions;
|
||||
}
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
Collections.sort(frequencys);
|
||||
return frequencys;
|
||||
}
|
||||
|
||||
public static List<String> getDepthBits() {
|
||||
List<String> bitRates = new ArrayList<String>();
|
||||
for (DisplayMode mode : GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayModes()) {
|
||||
if (!bitRates.contains(String.valueOf(mode.getBitDepth()))) {
|
||||
bitRates.add(String.valueOf(mode.getBitDepth()));
|
||||
}
|
||||
}
|
||||
Collections.sort(bitRates);
|
||||
return bitRates;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package org.wyrez.shootingstars.states;
|
||||
|
||||
import com.jme3.app.state.AbstractAppState;
|
||||
import com.jme3.app.state.AppStateManager;
|
||||
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 tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class FileMetaInfoState extends AbstractAppState implements FileMetaInfoListener {
|
||||
|
||||
private StateManager stateManager;
|
||||
private GameSettings settings;
|
||||
private Gui gui;
|
||||
|
||||
public FileMetaInfoState(Screen screen, StateManager stateManager, GameSettings settings) {
|
||||
this.stateManager = stateManager;
|
||||
this.settings = settings;
|
||||
this.gui = new FileMetaInfoGUI(screen, this, settings);
|
||||
}
|
||||
|
||||
public void startLoading() {
|
||||
stateManager.setState(State.LOADING);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
stateManager.setState(State.MENU);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateAttached(AppStateManager stateManager) {
|
||||
gui.attach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateDetached(AppStateManager stateManager) {
|
||||
gui.detach();
|
||||
}
|
||||
}
|
||||
@ -16,10 +16,12 @@
|
||||
*/
|
||||
package org.wyrez.shootingstars.states;
|
||||
|
||||
|
||||
import com.jme3.app.state.AbstractAppState;
|
||||
import com.jme3.app.state.AppStateManager;
|
||||
import com.jme3.asset.AssetManager;
|
||||
import com.jme3.input.InputManager;
|
||||
import com.jme3.input.controls.ActionListener;
|
||||
import com.jme3.math.Vector3f;
|
||||
import com.jme3.post.FilterPostProcessor;
|
||||
import com.jme3.post.filters.BloomFilter;
|
||||
@ -50,7 +52,7 @@ import uk.co.caprica.vlcj.player.direct.DirectMediaPlayer;
|
||||
*
|
||||
* @author Darth Affe
|
||||
*/
|
||||
public class GameState extends AbstractAppState implements GameListener {
|
||||
public class GameState extends AbstractAppState implements GameListener, ActionListener {
|
||||
|
||||
private StateManager stateManager;
|
||||
private AssetManager assetManager;
|
||||
@ -68,12 +70,16 @@ public class GameState extends AbstractAppState implements GameListener {
|
||||
private Spatial player;
|
||||
private boolean isRunning = false;
|
||||
|
||||
|
||||
public GameState(Node rootNode, Screen screen, StateManager stateManager,
|
||||
AssetManager assetManager, ViewPort viewPort,
|
||||
InputManager inputManager, Camera camera, AudioDataManager audioDataManager) {
|
||||
InputManager inputManager, Camera camera, AudioDataManager audioDataManager, GameSettings settings) {
|
||||
|
||||
this.rootNode = rootNode;
|
||||
this.gui = new GameGUI(screen, this);
|
||||
this.gui = new GameGUI(screen, this, assetManager);
|
||||
this.stateManager = stateManager;
|
||||
inputManager.addListener(this, new String[]{"ESC"});
|
||||
|
||||
this.inputManager = inputManager;
|
||||
this.camera = camera;
|
||||
this.audioDataManager = audioDataManager;
|
||||
@ -82,7 +88,7 @@ public class GameState extends AbstractAppState implements GameListener {
|
||||
|
||||
mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet");
|
||||
|
||||
this.settings = new GameSettings("Shades of AMV.mp3", "Shades of AMV.webm");
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public void setSettings(GameSettings settings) {
|
||||
@ -119,7 +125,7 @@ public class GameState extends AbstractAppState implements GameListener {
|
||||
player.setUserData(UserDataKeys.RUNNING, false);
|
||||
player.addControl(new PlayerMouseControl(inputManager, camera));
|
||||
player.addControl(new PlayerMoveControl(audioDataManager));
|
||||
player.addControl(new PlayerShootControl(inputManager));
|
||||
player.addControl(new PlayerShootControl(inputManager, gui));
|
||||
player.addControl(new PlayerCamControl(camera));
|
||||
}
|
||||
|
||||
@ -183,4 +189,21 @@ public class GameState extends AbstractAppState implements GameListener {
|
||||
public boolean isRunning() {
|
||||
return isRunning;
|
||||
}
|
||||
|
||||
public void onAction(String name, boolean isPressed, float tpf) {
|
||||
if (name.equals("ESC") && !isPressed) {
|
||||
gui.showMenu();
|
||||
//cinema.pause();
|
||||
}
|
||||
}
|
||||
|
||||
public void resume() {
|
||||
gui.resumeGame();
|
||||
//cinema.play();
|
||||
}
|
||||
|
||||
public void cancelTrack() {
|
||||
//cinema.stop();
|
||||
stateManager.setState(State.MENU);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.states;
|
||||
|
||||
import com.jme3.app.state.AbstractAppState;
|
||||
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 tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class HighscoreState extends AbstractAppState implements HighscoreListener{
|
||||
|
||||
private StateManager stateManager;
|
||||
private Gui gui;
|
||||
|
||||
public HighscoreState(Screen screen, StateManager stateManager) {
|
||||
this.stateManager = stateManager;
|
||||
this.gui = new HighscoreGUI(screen, this);
|
||||
}
|
||||
|
||||
public void back() {
|
||||
stateManager.setState(State.MENU);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateAttached(AppStateManager stateManager) {
|
||||
gui.attach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateDetached(AppStateManager stateManager) {
|
||||
gui.detach();
|
||||
}
|
||||
}
|
||||
@ -16,8 +16,10 @@
|
||||
*/
|
||||
package org.wyrez.shootingstars.states;
|
||||
|
||||
import com.jme3.app.Application;
|
||||
import com.jme3.app.state.AbstractAppState;
|
||||
import com.jme3.app.state.AppStateManager;
|
||||
import org.wyrez.shootingstars.ShootingStars;
|
||||
import org.wyrez.shootingstars.gui.Gui;
|
||||
import org.wyrez.shootingstars.gui.MenuGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.MenuListener;
|
||||
@ -31,18 +33,28 @@ public class MenuState extends AbstractAppState implements MenuListener {
|
||||
|
||||
private StateManager stateManager;
|
||||
private Gui gui;
|
||||
private ShootingStars shootingStars;
|
||||
|
||||
public MenuState(Screen screen, StateManager stateManager) {
|
||||
public MenuState(Screen screen, StateManager stateManager, ShootingStars shootingStars) {
|
||||
this.stateManager = stateManager;
|
||||
this.gui = new MenuGUI(screen, this);
|
||||
this.shootingStars = shootingStars;
|
||||
}
|
||||
|
||||
public void startGame() {
|
||||
stateManager.setState(State.LOADING);
|
||||
public void selectFile() {
|
||||
stateManager.setState(State.SELECTTRACK);
|
||||
}
|
||||
|
||||
public void exitGame() {
|
||||
//TODO ss.stop();
|
||||
shootingStars.stop();
|
||||
}
|
||||
|
||||
public void openhighscore() {
|
||||
stateManager.setState(State.HIGHSCORE);
|
||||
}
|
||||
|
||||
public void openOptions() {
|
||||
stateManager.setState(State.OPTIONS);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.states;
|
||||
|
||||
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.states.util.OptionSettings;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class OptionsState extends AbstractAppState implements OptionsListener {
|
||||
|
||||
private StateManager stateManager;
|
||||
private OptionsGUI gui;
|
||||
private OptionSettings settings;
|
||||
|
||||
public OptionsState(Screen screen, StateManager stateManager, OptionSettings settings) {
|
||||
this.stateManager = stateManager;
|
||||
this.settings = settings;
|
||||
this.gui = new OptionsGUI(screen, this,settings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateAttached(AppStateManager stateManager) {
|
||||
gui.attach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateDetached(AppStateManager stateManager) {
|
||||
gui.detach();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
stateManager.setState(State.MENU);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
stateManager.setState(State.MENU);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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.states;
|
||||
|
||||
import com.jme3.app.state.AbstractAppState;
|
||||
import com.jme3.app.state.AppStateManager;
|
||||
import java.io.File;
|
||||
import javax.swing.JFileChooser;
|
||||
import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.gui.SelectTrackGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.SelectFileListener;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class SelectTrackState extends AbstractAppState implements SelectFileListener{
|
||||
|
||||
private StateManager stateManager;
|
||||
private GameSettings settings;
|
||||
private SelectTrackGUI gui;
|
||||
|
||||
public SelectTrackState(Screen screen, StateManager stateManager, GameSettings settings) {
|
||||
this.stateManager = stateManager;
|
||||
this.settings = settings;
|
||||
this.gui = new SelectTrackGUI(screen, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateAttached(AppStateManager stateManager) {
|
||||
gui.attach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateDetached(AppStateManager stateManager) {
|
||||
gui.detach();
|
||||
}
|
||||
|
||||
public void selectFile() {
|
||||
JFileChooser jFileChooser = new JFileChooser();
|
||||
int returnVal = jFileChooser.showOpenDialog(null);
|
||||
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = jFileChooser.getSelectedFile();
|
||||
settings.setAudioFile(file.getAbsolutePath());
|
||||
stateManager.setState(State.FILEMETAINFO);
|
||||
}
|
||||
}
|
||||
|
||||
public void downloadYT() {
|
||||
stateManager.setState(State.YTDOWNLOAD);
|
||||
}
|
||||
}
|
||||
@ -25,7 +25,10 @@ import com.jme3.app.state.AppState;
|
||||
public enum State {
|
||||
|
||||
NONE(null), START(StartState.class), MENU(MenuState.class),
|
||||
LOADING(LoadingState.class), GAME(GameState.class);
|
||||
LOADING(LoadingState.class), GAME(GameState.class),
|
||||
SELECTTRACK(SelectTrackState.class), YTDOWNLOAD(YTDownloadState.class),
|
||||
OPTIONS(OptionsState.class), HIGHSCORE(HighscoreState.class),
|
||||
FILEMETAINFO(FileMetaInfoState.class);
|
||||
private static State currentState = State.NONE;
|
||||
private static State previousState = State.NONE;
|
||||
private final Class clazz;
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* 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.states;
|
||||
|
||||
import com.jme3.app.state.AbstractAppState;
|
||||
import com.jme3.app.state.AppStateManager;
|
||||
import org.wyrez.shootingstars.game.GameSettings;
|
||||
import org.wyrez.shootingstars.gui.YTDownloadGUI;
|
||||
import org.wyrez.shootingstars.gui.listener.YTDownloadListener;
|
||||
import tonegod.gui.core.Screen;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class YTDownloadState extends AbstractAppState implements YTDownloadListener{
|
||||
|
||||
private StateManager stateManager;
|
||||
private GameSettings settings;
|
||||
private YTDownloadGUI gui;
|
||||
|
||||
|
||||
public YTDownloadState(Screen screen, StateManager stateManager, GameSettings settings) {
|
||||
this.stateManager = stateManager;
|
||||
this.settings = settings;
|
||||
this.gui = new YTDownloadGUI(screen, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateAttached(AppStateManager stateManager) {
|
||||
gui.attach();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stateDetached(AppStateManager stateManager) {
|
||||
gui.detach();
|
||||
}
|
||||
|
||||
public void downloadYTVideo(String url) {
|
||||
//TODO: Download Video
|
||||
System.out.println(url);
|
||||
stateManager.setState(State.FILEMETAINFO);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,212 @@
|
||||
/*
|
||||
* 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.states.util;
|
||||
|
||||
import com.jme3.system.AppSettings;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Snowsun
|
||||
*/
|
||||
public class OptionSettings {
|
||||
private AppSettings settings;
|
||||
private static final String FILENAME = "shootingstars.conf";
|
||||
|
||||
public void init(boolean loadDefault) {
|
||||
settings = new AppSettings(loadDefault);
|
||||
create(loadDefault);
|
||||
}
|
||||
|
||||
public void init(AppSettings settings) {
|
||||
settings = new AppSettings(false);
|
||||
settings.putAll(settings);
|
||||
}
|
||||
|
||||
private void create(boolean loadDefault) {
|
||||
if (loadDefault) {
|
||||
settings.setResolution(1024, 600);
|
||||
settings.setTitle("Shooting Stars");
|
||||
settings.setSettingsDialogImage("");
|
||||
setMasterVolume(100);
|
||||
setFXVolume(100);
|
||||
setSoundVolume(100);
|
||||
setUsername("Player");
|
||||
setPostProcessing(true);
|
||||
setParticleDensity(3);
|
||||
}
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
settings.putString("Username", username);
|
||||
}
|
||||
|
||||
public void setMenuStyle(String style) {
|
||||
settings.putString("MenuStyle", style);
|
||||
}
|
||||
|
||||
public void setTransitionSpeed(int speed) {
|
||||
settings.putInteger("TransitionSpeed", speed);
|
||||
}
|
||||
|
||||
public void setMasterVolume(int volume) {
|
||||
settings.putInteger("MasterVolume", volume);
|
||||
}
|
||||
|
||||
public void setMusicVolume(int volume) {
|
||||
settings.putInteger("MusicVolume", volume);
|
||||
}
|
||||
|
||||
public void setFXVolume(int volume) {
|
||||
settings.putInteger("FXVolume", volume);
|
||||
}
|
||||
|
||||
public void setSoundVolume(int volume) {
|
||||
settings.putInteger("SoundVolume", volume);
|
||||
}
|
||||
|
||||
public void setPostProcessing(boolean enabled) {
|
||||
settings.putBoolean("PostProcessing", enabled);
|
||||
}
|
||||
|
||||
public void setFullscreen(boolean enabled) {
|
||||
settings.setFullscreen(enabled);
|
||||
}
|
||||
|
||||
public void setVSync(boolean enabled) {
|
||||
settings.setVSync(enabled);
|
||||
}
|
||||
|
||||
public void setHeight(int height) {
|
||||
settings.setHeight(height);
|
||||
}
|
||||
|
||||
public void setWidth(int width) {
|
||||
settings.setWidth(width);
|
||||
}
|
||||
|
||||
public void setFrequency(int frequency) {
|
||||
settings.setFrequency(frequency);
|
||||
}
|
||||
|
||||
public void setDepthBits(int depthBits) {
|
||||
settings.setDepthBits(depthBits);
|
||||
}
|
||||
|
||||
public void setParticleDensity(int particleDensity) {
|
||||
settings.putInteger("ParticleDensity", particleDensity);
|
||||
}
|
||||
|
||||
public int getKey(String keyId) {
|
||||
return settings.getInteger(keyId);
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return settings.getString("Username");
|
||||
}
|
||||
|
||||
public int getMasterVolume() {
|
||||
return settings.getInteger("MasterVolume");
|
||||
}
|
||||
|
||||
public int getMusicVolume() {
|
||||
return settings.getInteger("MusicVolume");
|
||||
}
|
||||
|
||||
public int getFXVolume() {
|
||||
return settings.getInteger("FXVolume");
|
||||
}
|
||||
|
||||
public int getSoundVolume() {
|
||||
return settings.getInteger("SoundVolume");
|
||||
}
|
||||
|
||||
public boolean isPostprocessingEnabled() {
|
||||
return settings.getBoolean("PostProcessing");
|
||||
}
|
||||
|
||||
public boolean isFullscreenEnabled() {
|
||||
return settings.isFullscreen();
|
||||
}
|
||||
|
||||
public boolean isVSyncEnabled() {
|
||||
return settings.isVSync();
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return settings.getHeight();
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return settings.getWidth();
|
||||
}
|
||||
|
||||
public int getFrequency() {
|
||||
return settings.getFrequency();
|
||||
}
|
||||
|
||||
public int getDepthBits() {
|
||||
return settings.getDepthBits();
|
||||
}
|
||||
|
||||
public int getParticleDensity() {
|
||||
return settings.getInteger("ParticleDensity");
|
||||
}
|
||||
|
||||
public void save() {
|
||||
try {
|
||||
OutputStream os = new FileOutputStream(FILENAME);
|
||||
settings.save(os);
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Can't save settings");
|
||||
}
|
||||
}
|
||||
|
||||
public void load() {
|
||||
try {
|
||||
InputStream is = new FileInputStream(FILENAME);
|
||||
settings.load(is);
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Can't load settings");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean saveExists() {
|
||||
return new File(FILENAME).exists();
|
||||
}
|
||||
|
||||
public void put(String key, Object value){
|
||||
settings.put(key, value);
|
||||
}
|
||||
|
||||
public Set<String> keySet() {
|
||||
return settings.keySet();
|
||||
}
|
||||
|
||||
public Object get(String key) {
|
||||
return settings.get(key);
|
||||
}
|
||||
|
||||
public AppSettings getAppSettings(){
|
||||
return settings;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user