added weapon, added new crosshair and heat indicator, improved tons of stuff

This commit is contained in:
Raybz@Raybz 2013-06-27 09:20:12 +02:00
parent 830f1edb0b
commit dffae3aa09
27 changed files with 186 additions and 119 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 877 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 KiB

Binary file not shown.

View File

@ -0,0 +1,3 @@
#
#Tue Jun 25 22:00:49 CEST 2013
ORIGINAL_PATH=Models/sniper.mesh.j3o

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 365 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 785 B

View File

@ -35,6 +35,7 @@ public class GroundBorderGlowControl extends BaseControl {
private Material material;
private float glowTimer = 0;
private boolean reset = false;
private int lastIndex = -1;
public GroundBorderGlowControl(AudioDataManager audioDataManager) {
this.audioDataManager = audioDataManager;
@ -48,7 +49,9 @@ public class GroundBorderGlowControl extends BaseControl {
@Override
public void update(float tpf) {
if (audioDataManager.isGroundMove()) {
int index;
if (audioDataManager.isGroundMove() && lastIndex < (index = audioDataManager.getGroundMoveIndex())) {
lastIndex = index;
glowTimer = GLOW_DURATION;
reset = true;
}

View File

@ -38,7 +38,8 @@ public class GroundGlowControl extends BaseControl {
private Material material;
private float glowTimer = 0;
private ColorRGBA color;
private int lastIndex;
public GroundGlowControl(AudioDataManager audioDataManager) {
this.audioDataManager = audioDataManager;
}
@ -51,7 +52,9 @@ public class GroundGlowControl extends BaseControl {
@Override
public void update(float tpf) {
if (audioDataManager.isFlash() && glowTimer <= 0f) {
int index;
if (audioDataManager.isFlash() && glowTimer <= 0f && lastIndex < (index = audioDataManager.getFlashIndex())) {
lastIndex = index;
if (random.nextBoolean()) {
glowTimer = GLOW_DURATION;
color = ColorHelper.calcColor(audioDataManager.getFlashData());
@ -63,7 +66,7 @@ public class GroundGlowControl extends BaseControl {
if (glowFactor > 0.5f) {
glowFactor = 1f;
} else {
glowFactor += 0.5f;
glowFactor *= 2f;
}
material.setColor("GlowColor", new ColorRGBA(color.r * glowFactor,
color.b * glowFactor, color.g * glowFactor, 1f));

View File

@ -38,6 +38,7 @@ public class GroundMoveControl extends BaseControl {
private float internalTimer = 0;
private Vector3f basePosition;
private float moveHeight;
private int lastIndex;
public GroundMoveControl(AudioDataManager audioDataManager) {
this.audioDataManager = audioDataManager;
@ -51,7 +52,9 @@ public class GroundMoveControl extends BaseControl {
@Override
public void update(float tpf) {
if (audioDataManager.isGroundMove() && moveTimer <= 0f) {
int index;
if (audioDataManager.isGroundMove() && moveTimer <= 0f && lastIndex < (index = audioDataManager.getGroundMoveIndex())) {
lastIndex = index;
if (random.nextBoolean()) {
moveTimer = MOVE_UP_DURATION + MOVE_DOWN_DURATION;
internalTimer = 0f;

View File

@ -37,7 +37,8 @@ public class PlayerCamControl extends BaseControl {
@Override
public void update(float tpf) {
if (spatial.getUserData(UserDataKeys.RUNNING)) {
camera.setLocation(spatial.getLocalTranslation());
camera.setLocation(spatial.getLocalTranslation()/*.add(new Vector3f(10f, 10f, 0f))*/);
camera.lookAt(spatial.getLocalTranslation(), Vector3f.UNIT_Y);
camera.setRotation(spatial.getLocalRotation());
}
}

View File

@ -34,19 +34,19 @@ import org.wyrez.shootingstars.helper.UserDataKeys;
public class PlayerShootControl extends BaseControl implements ActionListener {
private static final String MAPPING_PLAYER_MOUSE_LEFT_CLICK = "PLAYER_Mouse_Left_Click";
private static final float maxTimeToOverheat = 3f;
private static final float maxCoolDown = 3f;
private static final float MAX_TIME_TO_OVERHEAT = 3f;
private static final float MAX_COOLDOWN = 1f;
/**/
private InputManager inputManager;
private GameGUI gui;
private float timeToOverheat = maxTimeToOverheat;
private float coolDown = 0f;
private float overheatTimer = 0f;
private float cooldownTimer = 0f;
private boolean wasOverheat = false;
private boolean isShooting = false;
public PlayerShootControl(InputManager inputmanager, GameGUI gui) {
this.inputManager = inputmanager;
this.gui = gui;
gui.setMaxTimeToOverheat(maxTimeToOverheat);
initMappings();
}
@ -54,24 +54,34 @@ public class PlayerShootControl extends BaseControl implements ActionListener {
protected void controlUpdate(float tpf) {
if (spatial.getUserData(UserDataKeys.RUNNING)) {
if (isShooting) {
if (coolDown <= 0f) {
timeToOverheat -= tpf;
gui.updateOverhead(timeToOverheat);
if (timeToOverheat <= 0) {
setShooting(false);
coolDown = maxCoolDown;
}
} else {
coolDown -= tpf;
overheatTimer += tpf;
if (overheatTimer >= MAX_TIME_TO_OVERHEAT) {
setShooting(false);
overheatTimer = MAX_TIME_TO_OVERHEAT;
cooldownTimer = MAX_COOLDOWN;
wasOverheat = true;
}
} else {
if (cooldownTimer > 0f) {
cooldownTimer -= tpf;
} else {
if (overheatTimer > 0f) {
overheatTimer -= tpf;
} else {
overheatTimer = 0f;
wasOverheat = false;
}
}
}
gui.updateOverhead(overheatTimer / MAX_TIME_TO_OVERHEAT);
}
}
private void setShooting(boolean isShooting) {
this.isShooting = isShooting;
spatial.setUserData(UserDataKeys.SHOOTING, isShooting);
if (!(wasOverheat && overheatTimer > 0f)) {
this.isShooting = isShooting;
spatial.setUserData(UserDataKeys.SHOOTING, isShooting);
}
}
@Override
@ -87,12 +97,7 @@ public class PlayerShootControl extends BaseControl implements ActionListener {
public void onAction(String name, boolean isPressed, float tpf) {
if (name.equals(MAPPING_PLAYER_MOUSE_LEFT_CLICK) && (Boolean) spatial.getUserData(UserDataKeys.RUNNING)) {
if (isPressed) {
setShooting(true);
} else {
setShooting(false);
timeToOverheat = maxTimeToOverheat;
}
setShooting(isPressed);
}
}

View File

@ -33,6 +33,12 @@ public class StarDeathControl extends BaseControl {
this.starNode = starNode;
}
@Override
public void setSpatial(Spatial spatial) {
super.setSpatial(spatial);
spatial.setUserData(UserDataKeys.HITTED, false);
}
@Override
protected void controlUpdate(float tpf) {
if (spatial.getUserData(UserDataKeys.HITTED)) {

View File

@ -16,6 +16,7 @@
*/
package org.wyrez.shootingstars.controls;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.scene.Geometry;
import com.jme3.scene.Spatial;
@ -30,11 +31,12 @@ import org.wyrez.shootingstars.helper.UserDataKeys;
public class StarPointControl extends BaseControl {
private static final float MAX_POINTS = 100f;
private static final float HIT_TIMER = 10f;
private static final float HIT_TIMER = 5f;
/**/
private float points;
private Spatial player;
private ColorRGBA color;
private Material material;
private float timer;
public StarPointControl(Spatial player, float value) {
@ -42,7 +44,13 @@ public class StarPointControl extends BaseControl {
this.points = (int) Math.round(MAX_POINTS * value);
this.timer = HIT_TIMER;
this.color = ColorHelper.calcColor(value / MAX_POINTS);
((Geometry) spatial).getMaterial().setColor("Color", color);
}
@Override
public void setSpatial(Spatial spatial) {
super.setSpatial(spatial);
this.material = ((Geometry) spatial).getMaterial();
material.setColor("Color", color);
}
@Override
@ -58,6 +66,7 @@ public class StarPointControl extends BaseControl {
points = 1f;
color = ColorHelper.calcColor(points / MAX_POINTS);
}
material.setColor("Color", color);
} else {
timer -= tpf;
}

View File

@ -123,7 +123,7 @@ public class AudioDataManager {
spawnData = audioProcessorMidBand.getPeaks();
float minValue = audioProcessorMidBand.getPeakAverage() * 0.5f;
float maxValue = audioProcessorHighBand.getPeakAverage() * 2f;
float maxValue = audioProcessorMidBand.getPeakAverage() * 2f;
for (int i = 0; i < spawnData.length; i++) {
if (spawnData[i] > maxValue) {
spawnData[i] = maxValue;
@ -192,20 +192,28 @@ public class AudioDataManager {
return index;
}
public int getFlashIndex() {
return calcIndex(flashData.length);
}
public boolean isFlash() {
return flashData[calcIndex(flashData.length)] > peakAverageFlash * 0.5f;
return flashData[getFlashIndex()] > peakAverageFlash * 0.5f;
}
public float getFlashData() {
return flashData[calcIndex(flashData.length)];
return flashData[getFlashIndex()];
}
public int getGroundMoveIndex() {
return calcIndex(groundMoveData.length);
}
public boolean isGroundMove() {
return groundMoveData[calcIndex(groundMoveData.length)] > 0f;
return groundMoveData[getGroundMoveIndex()] > 0f;
}
public float getGroundMoveData() {
return groundMoveData[calcIndex(groundMoveData.length)];
return groundMoveData[getGroundMoveIndex()];
}
public float getMovementData() {
@ -219,14 +227,13 @@ public class AudioDataManager {
public float[] getSpawnData() {
int index = calcIndex(spawnData.length);
float[] data;
if (index == lastSpawnDataPollIndex) {
if (index <= lastSpawnDataPollIndex) {
data = null;
} else if (index - 1 != lastSpawnDataPollIndex) {
data = new float[index - lastSpawnDataPollIndex];
for (int i = 0; i < data.length; i++) {
data[i] = spawnData[lastSpawnDataPollIndex + 1 + i];
}
return data;
} else {
data = new float[]{spawnData[index]};
}

View File

@ -27,7 +27,7 @@ import com.jme3.math.ColorRGBA;
public enum Materials {
UNSHADED("Common/MatDefs/Misc/Unshaded.j3md", null, null, null),
HEX("Common/MatDefs/Light/Lighting.j3md", "Textures/Hex.png", null, null),
HEX("Common/MatDefs/Light/Lighting.j3md", "Textures/hex.png", null, null),
WEAPON("Common/MatDefs/Light/Lighting.j3md", null, ColorRGBA.White, ColorRGBA.Cyan),
GLOW("Common/MatDefs/Light/Lighting.j3md", null, ColorRGBA.White, ColorRGBA.Black),
STAR("Common/MatDefs/Misc/Unshaded.j3md", null, null, null);

View File

@ -34,7 +34,9 @@ import org.wyrez.shootingstars.controls.WeaponProjectileControl;
import org.wyrez.shootingstars.data.AudioDataManager;
import org.wyrez.shootingstars.factories.Materials;
import org.wyrez.shootingstars.gui.GameGUI;
import org.wyrez.shootingstars.helper.MathHelper;
import org.wyrez.shootingstars.helper.UserDataKeys;
import org.wyrez.shootingstars.mesh.HexPrism;
import org.wyrez.shootingstars.states.StateManager;
/**
@ -43,18 +45,20 @@ import org.wyrez.shootingstars.states.StateManager;
*/
public class Player extends Node {
private Node weaponContainer;
private Spatial weapon;
private Spatial projectile;
private Node projectile;
public Player(Node rootNode, StateManager stateManager, AssetManager assetManager,
ViewPort viewPort, GameGUI gui, InputManager inputManager, Camera camera,
AudioDataManager audioDataManager) {
super("Player");
initPlayer(inputManager, camera, audioDataManager, gui);
//TODO implement
// initWeapon(assetManager);
// initProjectile(rootNode);
// addLight();
initWeapon(assetManager);
initProjectile(rootNode);
initWeaponContainer();
addLight();
}
private void initPlayer(InputManager inputManager, Camera camera,
@ -68,17 +72,39 @@ public class Player extends Node {
}
private void initWeapon(AssetManager assetManager) {
weapon = assetManager.loadModel("Models/LaserGun.j3o");
weapon.move(10f, 0f, 0f);
this.attachChild(weapon);
weapon = assetManager.loadModel("Models/sniper.mesh.j3o");
weapon.rotate(0f, MathHelper.degreeToRadian(90f), 0f);
weapon.scale(0.33f);
}
private void initProjectile(Node rootNode) {
projectile = new Geometry("weapon", new Box(0.01f, 0.01f, 2f));
projectile.addControl(new WeaponProjectileControl(rootNode, this));
projectile.setMaterial(Materials.WEAPON.create());
projectile = new Node("projectile");
this.attachChild(projectile);
Geometry geom1 = new Geometry("weapon", new HexPrism(0.1f, 3f));
geom1.setMaterial(Materials.WEAPON.create());
geom1.rotate(MathHelper.degreeToRadian(90f), 0f, 0f);
geom1.move(0f, -0.15f, 0f);
projectile.attachChild(geom1);
Geometry geom2 = new Geometry("weapon", new Box(0.1f, 0.2f, 4.25f));
geom2.setMaterial(Materials.WEAPON.create());
geom2.move(0f, 0.25f, -5f);
projectile.attachChild(geom2);
projectile.addControl(new WeaponProjectileControl(rootNode, this));
}
private void initWeaponContainer() {
weaponContainer = new Node("weaponContainer");
weaponContainer.attachChild(weapon);
weaponContainer.attachChild(projectile);
weaponContainer.rotate(MathHelper.degreeToRadian(-10f), MathHelper.degreeToRadian(10f), MathHelper.degreeToRadian(-5f));
weaponContainer.move(-0.41f, -0.28f, 9f);
weaponContainer.scale(0.75f);
this.attachChild(weaponContainer);
}
private void addLight() {

View File

@ -23,6 +23,7 @@ import com.jme3.math.Vector3f;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
import java.util.Arrays;
import java.util.Random;
import org.wyrez.shootingstars.controls.StarDeathControl;
import org.wyrez.shootingstars.controls.StarFaceControl;
@ -40,7 +41,8 @@ import org.wyrez.shootingstars.states.GameState;
public class StarManager extends Node {
private static final Random random;
private static final float MAX_STAR_SIZE = 75f;
private static final float MAX_STAR_SIZE = 15f;
private static final float VAR_STAR_SIZE = 10f;
static {
random = new Random();
@ -75,18 +77,20 @@ public class StarManager extends Node {
}
private float calcSize(float data) {
return MAX_STAR_SIZE - 50f * data;
return MAX_STAR_SIZE - VAR_STAR_SIZE * data;
}
private void spawn(Vector3f location, float size, float value) {
Geometry star = new Geometry("Star", new Star(size, size * 0.2f, 0.5f));
star.addControl(new StarFaceControl(player));
star.addControl(new StarDeathControl(this));
star.addControl(new StarPointControl(player, value));
star.setLocalTranslation(location);
Material mat = Materials.STAR.create();
mat.setColor("Color", ColorRGBA.Yellow);
star.setMaterial(mat);
star.addControl(new StarFaceControl(player));
star.addControl(new StarDeathControl(this));
star.addControl(new StarPointControl(player, value));
this.attachChild(star);
}

View File

@ -19,40 +19,37 @@ package org.wyrez.shootingstars.gui;
import com.jme3.asset.AssetManager;
import com.jme3.font.BitmapFont;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
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.lists.Dial;
import tonegod.gui.controls.text.Label;
import tonegod.gui.controls.windows.Panel;
import tonegod.gui.core.Screen;
import tonegod.gui.effects.Effect;
/**
*
* @author Darth Affe
*/
public class GameGUI extends Panel {
private GameListener listener;
private Button btnStart;
private Button btnResume;
private Button btnMenu;
private Picture picCrosshair;
private Indicator indOverheat;
private Dial indOverheat;
private AssetManager assetManager;
private Spatial player;
private Label lblPoints;
private ScreenHelper screenHelper;
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;
@ -62,25 +59,19 @@ public class GameGUI extends Panel {
this.setIsVisible(false);
create();
}
private void create() {
float startPointx = screenHelper.calcX(537f);
float startPointy = screenHelper.calcY(576f);
float startPointCrosshairx = screenHelper.calcX(441f);
float startPointCrosshairy = screenHelper.calcY(560f);
float startPointOverheatx = screenHelper.calcX(505f);
float startPointOverheaty = screenHelper.calcY(270f);
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(screenHelper.calcX(200f), screenHelper.calcY(30f))) {
@Override
@ -91,7 +82,7 @@ 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(screenHelper.calcX(200f), screenHelper.calcY(30f))) {
@Override
@ -102,7 +93,7 @@ public class GameGUI extends Panel {
btnResume.setText("Resume");
btnResume.setTextAlign(BitmapFont.Align.Center);
btnResume.setFontSize(labelFontSize);
btnMenu = new ButtonBase(screen, new Vector2f(startPointx, startPointYMenu + screenHelper.calcY(40f)),
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f))) {
@Override
@ -113,42 +104,51 @@ public class GameGUI extends Panel {
btnMenu.setText("Menu");
btnMenu.setTextAlign(BitmapFont.Align.Center);
btnMenu.setFontSize(labelFontSize);
picCrosshair = new Picture("Crosshair");
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));
plnCrosshair.setIsVisible(false);
plnCrosshair.setIgnoreMouse(true);
plnCrosshair.attachChild(picCrosshair);
indOverheat = new IndicatorBase(screen, new Vector2f(startPointOverheatx, startPointOverheaty),
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.setIndicatorImage("Textures/Crosshair_Overheat_Fog.png");
picCrosshair = new Picture("Crosshair");
picCrosshair.setWidth(screenHelper.calcX(50f));
picCrosshair.setHeight(screenHelper.calcY(50f));
picCrosshair.setImage(assetManager, "Textures/crosshair.png", true);
Panel pnlCrosshair = new Panel(screen, new Vector2f(0f, 0f), new Vector2f(0f, 0f));
pnlCrosshair.setIsVisible(false);
pnlCrosshair.setIgnoreMouse(true);
pnlCrosshair.attachChild(picCrosshair);
pnlCrosshair.centerToParent();
picCrosshair.center();
indOverheat = new Dial(screen, pnlCrosshair.getPosition()) {
@Override
public void onChange(int arg0, Object arg1) {
}
};
indOverheat.setGapStartAngle(60);
indOverheat.setGapEndAngle(296);
indOverheat.setWidth(screenHelper.calcX(50f));
indOverheat.setHeight(screenHelper.calcY(50f));
indOverheat.centerToParent();
indOverheat.setDialImageBackground("Textures/empty.png");
indOverheat.setDialImageIndicator("Textures/heat_ind.png");
updateOverhead(0f);
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(btnMenu);
this.addChild(indOverheat);
this.addChild(plnCrosshair);
this.addChild(pnlCrosshair);
this.addChild(lblPoints);
btnResume.hide();
btnMenu.hide();
picCrosshair.setCullHint(CullHint.Always);
indOverheat.hide();
lblPoints.hide();
}
public void setStart() {
btnStart.hide();
btnResume.hide();
@ -157,7 +157,7 @@ public class GameGUI extends Panel {
indOverheat.show();
lblPoints.show();
}
public void setWait() {
btnStart.show();
btnResume.hide();
@ -166,7 +166,7 @@ public class GameGUI extends Panel {
indOverheat.hide();
lblPoints.hide();
}
public void showMenu() {
btnStart.hide();
btnResume.show();
@ -175,7 +175,7 @@ public class GameGUI extends Panel {
indOverheat.hide();
lblPoints.hide();
}
public void resumeGame() {
btnStart.hide();
btnResume.hide();
@ -184,27 +184,23 @@ public class GameGUI extends Panel {
indOverheat.show();
lblPoints.show();
}
public void attach() {
screen.addElement(this);
}
public void detach() {
screen.removeElement(this);
}
public void updateOverhead(float percent) {
indOverheat.setCurrentValue(percent);
indOverheat.setSelectedIndex(100*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));

View File

@ -82,7 +82,6 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
this.audioDataManager = audioDataManager;
this.assetManager = assetManager;
this.viewPort = viewPort;
this.starManager = new StarManager(audioDataManager, player);
mediaPlayerFactory = new MediaPlayerFactory("--no-video-title-show", "--quiet");
@ -113,6 +112,9 @@ public class GameState extends AbstractAppState implements GameListener, ActionL
inputManager, camera, audioDataManager);
gui.setPlayer(player);
//Out of possition, but it needs an initialized player...
this.starManager = new StarManager(audioDataManager, player);
}
private void setRunning(boolean running) {

View File

@ -46,7 +46,7 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
GameSettings settings, YTDownloader downloader, ScreenHelper screenHelper) {
this.stateManager = stateManager;
this.settings = settings;
this.gui = new YTDownloadGUI(screen, this,screenHelper);
this.gui = new YTDownloadGUI(screen, this, screenHelper);
this.downloader = downloader;
}
@ -73,11 +73,10 @@ public class YTDownloadState extends AbstractAppState implements YTDownloadListe
String path;
if ((path = getVideoCache(identifier)) == null) {
downloader.download(url, PathHelper.getCacheFolder());
path = downloader.getLastTarget().getPath();
new File(path).renameTo(new File(PathHelper.getCacheFolder()
+ identifier + path.substring(path.lastIndexOf("."), path.length())));
System.out.println("rename " + path + " --> " + (PathHelper.getCacheFolder()
+ identifier + path.substring(path.lastIndexOf("."), path.length())));
String targetPath = downloader.getLastTarget().getPath();
path = PathHelper.getCacheFolder() + identifier
+ targetPath.substring(targetPath.lastIndexOf("."), targetPath.length());
new File(targetPath).renameTo(new File(path));
}
settings.setVideoFile(path);
stateManager.setState(State.FILEMETAINFO);

View File

@ -55,7 +55,7 @@ public class OptionSettings {
private void create(boolean loadDefault) {
if (loadDefault) {
settings.setResolution(1024, 600);
settings.setResolution(1280, 720);
settings.setTitle("Shooting Stars");
settings.setSettingsDialogImage("");
setMasterVolume(100);