merged
This commit is contained in:
commit
62122dcb7e
BIN
ShootingStars/assets/Textures/Crosshair_AlphaMap.png
Normal file
BIN
ShootingStars/assets/Textures/Crosshair_AlphaMap.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.3 KiB |
BIN
ShootingStars/assets/Textures/Crosshair_Overheat_Fog.png
Normal file
BIN
ShootingStars/assets/Textures/Crosshair_Overheat_Fog.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
BIN
ShootingStars/assets/Textures/Crosshair_OverlayImage.png
Normal file
BIN
ShootingStars/assets/Textures/Crosshair_OverlayImage.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 365 B |
@ -35,15 +35,18 @@ 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 InputManager inputManager;
|
||||
private GameGUI gui;
|
||||
private float timeToOverheat = maxTimeToOverheat;
|
||||
private float coolDown = 0f;
|
||||
private boolean isShooting = false;
|
||||
|
||||
public PlayerShootControl(InputManager inputmanager, GameGUI gui) {
|
||||
this.inputManager = inputmanager;
|
||||
this.gui = gui;
|
||||
gui.setMaxTimeToOverheat(maxTimeToOverheat);
|
||||
initMappings();
|
||||
}
|
||||
|
||||
@ -51,10 +54,17 @@ public class PlayerShootControl extends BaseControl implements ActionListener {
|
||||
protected void controlUpdate(float tpf) {
|
||||
if (spatial.getUserData(UserDataKeys.RUNNING)) {
|
||||
if (isShooting) {
|
||||
timeToOverheat -= tpf;
|
||||
if (timeToOverheat <= 0) {
|
||||
setShooting(false);
|
||||
if (coolDown <= 0f) {
|
||||
timeToOverheat -= tpf;
|
||||
gui.updateOverhead(timeToOverheat);
|
||||
if (timeToOverheat <= 0) {
|
||||
setShooting(false);
|
||||
coolDown = maxCoolDown;
|
||||
}
|
||||
} else {
|
||||
coolDown -= tpf;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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;
|
||||
@ -24,9 +40,10 @@ 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";
|
||||
private String fileName = "";
|
||||
private String duration = "";
|
||||
private String title = "";
|
||||
private String artist = "";
|
||||
|
||||
public FileMetaInfoGUI(Screen screen, FileMetaInfoListener listener, GameSettings settings) {
|
||||
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f));
|
||||
@ -39,7 +56,7 @@ public class FileMetaInfoGUI extends Panel implements Gui {
|
||||
|
||||
private void create() {
|
||||
float startPointx = 256f;
|
||||
float startPointy = 252f;
|
||||
float startPointy = 202f;
|
||||
float marginLeft = 110f;
|
||||
float buttonWidth = 153.6f;
|
||||
|
||||
@ -52,33 +69,39 @@ public class FileMetaInfoGUI extends Panel implements Gui {
|
||||
|
||||
readMetaData(file);
|
||||
|
||||
Label lblArtistHead = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(100f, 40f));
|
||||
Label lblFileNameHead = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(100f, 40f));
|
||||
lblFileNameHead.setText("Track Name");
|
||||
|
||||
Label lblFileName = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy), new Vector2f(400f, 40f));
|
||||
lblFileName.setText(fileName);
|
||||
|
||||
Label lblArtistHead = new Label(screen, new Vector2f(startPointx, startPointy + 50f), new Vector2f(100f, 40f));
|
||||
lblArtistHead.setText("Artist");
|
||||
|
||||
Label lblArtist = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy), new Vector2f(400f, 40f));
|
||||
Label lblArtist = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 50f), new Vector2f(400f, 40f));
|
||||
lblArtist.setText(artist);
|
||||
|
||||
Label lblTitelHead = new Label(screen, new Vector2f(startPointx, startPointy + 50f), new Vector2f(100f, 40f));
|
||||
Label lblTitelHead = new Label(screen, new Vector2f(startPointx, startPointy + 100f), new Vector2f(100f, 40f));
|
||||
lblTitelHead.setText("Titel");
|
||||
|
||||
Label lblTitel = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 50f), new Vector2f(400f, 40f));
|
||||
Label lblTitel = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 100f), new Vector2f(400f, 40f));
|
||||
lblTitel.setText(title);
|
||||
|
||||
Label lblDurationHead = new Label(screen, new Vector2f(startPointx, startPointy + 100f), new Vector2f(100f, 40f));
|
||||
Label lblDurationHead = new Label(screen, new Vector2f(startPointx, startPointy + 150f), new Vector2f(100f, 40f));
|
||||
lblDurationHead.setText("Duration");
|
||||
|
||||
Label lblDuration = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 100f), new Vector2f(400f, 40f));
|
||||
Label lblDuration = new Label(screen, new Vector2f(startPointx + marginLeft, startPointy + 150f), new Vector2f(400f, 40f));
|
||||
lblDuration.setText(duration);
|
||||
|
||||
Button btnStartLoading = new ButtonBase(screen, new Vector2f(startPointx + 500f, startPointy + 400f), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnStartLoading = new ButtonBase(screen, new Vector2f(startPointx + 653f, startPointy + 438.8f), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.startLoading();
|
||||
}
|
||||
};
|
||||
btnStartLoading.setText("Start Loading");
|
||||
btnStartLoading.setText("Play");
|
||||
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx + 750f, startPointy + 400f), new Vector2f(buttonWidth, 40)) {
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx + 836f, startPointy + 438.8f), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancel();
|
||||
@ -86,6 +109,8 @@ public class FileMetaInfoGUI extends Panel implements Gui {
|
||||
};
|
||||
btnCancel.setText("Cancel");
|
||||
|
||||
this.addChild(lblFileNameHead);
|
||||
this.addChild(lblFileName);
|
||||
this.addChild(lblArtistHead);
|
||||
this.addChild(lblArtist);
|
||||
this.addChild(lblTitelHead);
|
||||
@ -98,12 +123,13 @@ public class FileMetaInfoGUI extends Panel implements Gui {
|
||||
|
||||
private void readMetaData(File file) {
|
||||
try {
|
||||
fileName = file.getName();
|
||||
AudioFile f = AudioFileIO.read(file);
|
||||
Tag tag = f.getTag();
|
||||
AudioHeader ah = f.getAudioHeader();
|
||||
|
||||
if (ah != null) {
|
||||
duration = String.valueOf(ah.getTrackLength());
|
||||
duration = String.valueOf(ah.getTrackLength()) + " s";
|
||||
}
|
||||
|
||||
if (tag != null) {
|
||||
|
||||
@ -19,14 +19,20 @@ 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.IndicatorBase;
|
||||
import org.wyrez.shootingstars.gui.listener.GameListener;
|
||||
import tonegod.gui.controls.buttons.Button;
|
||||
import tonegod.gui.controls.extras.Indicator;
|
||||
import tonegod.gui.controls.text.Label;
|
||||
import tonegod.gui.controls.windows.Panel;
|
||||
import tonegod.gui.core.Screen;
|
||||
import tonegod.gui.effects.Effect;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -39,6 +45,7 @@ public class GameGUI extends Panel {
|
||||
private Button btnResume;
|
||||
private Button btnMenu;
|
||||
private Picture picCrosshair;
|
||||
private Indicator indOverheat;
|
||||
private AssetManager assetManager;
|
||||
|
||||
public GameGUI(Screen screen, GameListener listener, AssetManager assetManager) {
|
||||
@ -58,6 +65,9 @@ public class GameGUI extends Panel {
|
||||
float startPointCrosshairx = 441f;
|
||||
float startPointCrosshairy = 560f;
|
||||
|
||||
float startPointOverheatx = 505f;
|
||||
float startPointOverheaty = 270f;
|
||||
|
||||
float startPointYMenu = 200f;
|
||||
|
||||
btnStart = new ButtonBase(screen, new Vector2f(startPointx, startPointy),
|
||||
@ -95,21 +105,28 @@ public class GameGUI extends Panel {
|
||||
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);
|
||||
|
||||
indOverheat = new IndicatorBase(screen, new Vector2f(startPointOverheatx, startPointOverheaty),
|
||||
new Vector2f(275f, 180f), Indicator.Orientation.VERTICAL);
|
||||
indOverheat.setIndicatorColor(new ColorRGBA(0f, 0f, 1f, 0.5f));
|
||||
indOverheat.setAlphaMap("Textures/Crosshair_AlphaMap.png");
|
||||
indOverheat.setOverlayImage("Textures/Crosshair_OverlayImage.png");
|
||||
//indOverheat.setBaseImage("Textures/Crosshair_Overheat_Fog.png");
|
||||
|
||||
this.addChild(btnStart);
|
||||
this.addChild(btnResume);
|
||||
this.addChild(btnMenu);
|
||||
this.addChild(indOverheat);
|
||||
this.addChild(plnCrosshair);
|
||||
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
indOverheat.hide();
|
||||
}
|
||||
|
||||
public void setStart() {
|
||||
@ -117,6 +134,7 @@ public class GameGUI extends Panel {
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Inherit);
|
||||
indOverheat.show();
|
||||
}
|
||||
|
||||
public void setWait() {
|
||||
@ -124,6 +142,7 @@ public class GameGUI extends Panel {
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
indOverheat.hide();
|
||||
}
|
||||
|
||||
public void showMenu() {
|
||||
@ -131,6 +150,7 @@ public class GameGUI extends Panel {
|
||||
btnResume.show();
|
||||
btnMenu.show();
|
||||
picCrosshair.setCullHint(CullHint.Always);
|
||||
indOverheat.hide();
|
||||
}
|
||||
|
||||
public void resumeGame() {
|
||||
@ -138,6 +158,7 @@ public class GameGUI extends Panel {
|
||||
btnResume.hide();
|
||||
btnMenu.hide();
|
||||
picCrosshair.setCullHint(CullHint.Inherit);
|
||||
indOverheat.show();
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
@ -149,6 +170,10 @@ public class GameGUI extends Panel {
|
||||
}
|
||||
|
||||
public void updateOverhead(float percent) {
|
||||
indOverheat.setCurrentValue(percent);
|
||||
}
|
||||
|
||||
public void setMaxTimeToOverheat(float maxTimeToOverheat) {
|
||||
indOverheat.setMaxValue(maxTimeToOverheat);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ public class HighscoreGUI extends Panel implements Gui {
|
||||
// marginScoreTop += 50f;
|
||||
// }
|
||||
|
||||
Button btnBack = new ButtonBase(screen, new Vector2f(startPointx + 1000f, startPointy + 610f), new Vector2f(153f, 40)) {
|
||||
Button btnBack = new ButtonBase(screen, new Vector2f(startPointx + 1060f, startPointy + 622.8f), new Vector2f(153f, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.back();
|
||||
|
||||
@ -42,10 +42,10 @@ public class SelectTrackGUI extends Panel implements Gui{
|
||||
}
|
||||
|
||||
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 startPointx = 576f;
|
||||
float startPointy = 260f;
|
||||
float labelFontSize = 76f;
|
||||
float buttonWidth = 153f;
|
||||
float marginLabelOrLeft = 45f;
|
||||
float marginLabelOrTop = 43f;
|
||||
float marginButtonYTDownloadTop = 129f;
|
||||
@ -70,9 +70,18 @@ public class SelectTrackGUI extends Panel implements Gui{
|
||||
};
|
||||
btnYTDownload.setText("YT Download");
|
||||
|
||||
Button btnCancel = new ButtonBase(screen, new Vector2f(startPointx, startPointy + marginButtonYTDownloadTop + 114f), new Vector2f(buttonWidth, 40)) {
|
||||
@Override
|
||||
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
|
||||
listener.cancel();
|
||||
}
|
||||
};
|
||||
btnCancel.setText("Cancel");
|
||||
|
||||
this.addChild(btnSelectFile);
|
||||
this.addChild(lblOr);
|
||||
this.addChild(btnYTDownload);
|
||||
this.addChild(btnCancel);
|
||||
}
|
||||
|
||||
public void attach() {
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
|
||||
@ -25,4 +25,6 @@ public interface SelectFileListener {
|
||||
public void selectFile();
|
||||
|
||||
public void downloadYT();
|
||||
|
||||
public void cancel();
|
||||
}
|
||||
|
||||
@ -1,3 +1,19 @@
|
||||
/*
|
||||
* 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;
|
||||
|
||||
@ -65,4 +65,8 @@ public class SelectTrackState extends AbstractAppState implements SelectFileList
|
||||
public void downloadYT() {
|
||||
stateManager.setState(State.YTDOWNLOAD);
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
stateManager.setState(State.MENU);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user