Expand GUI
This commit is contained in:
parent
6c393ef77a
commit
e5d435985c
@ -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) {
|
||||
|
||||
@ -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