This commit is contained in:
Raybz@Raybz 2013-06-07 14:55:13 +02:00
commit d155041e52
6 changed files with 44 additions and 40 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -20,7 +20,6 @@ import com.jme3.font.BitmapFont;
import com.jme3.input.event.MouseButtonEvent;
import com.jme3.math.Vector2f;
import org.wyrez.shootingstars.gui.controls.ButtonBase;
import org.wyrez.shootingstars.gui.controls.PanelBase;
import org.wyrez.shootingstars.gui.listener.GameListener;
import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.windows.Panel;
@ -33,7 +32,7 @@ import tonegod.gui.core.Screen;
public class GameGUI extends Panel {
private GameListener listener;
private Panel pnlStart;
private Button btnStart;
public GameGUI(Screen screen, GameListener listener) {
super(screen, new Vector2f(0f, 0f), new Vector2f(1280f, 720f)); //create for full hd
@ -41,34 +40,32 @@ public class GameGUI extends Panel {
this.setIgnoreMouse(true);
this.setIsVisible(false);
create();
this.resize(screen.getWidth(), screen.getHeight(), Borders.SE);
}
private void create() {
pnlStart = new PanelBase(screen, new Vector2f(15, 15), new Vector2f(800, 500));
pnlStart.setIgnoreMouse(true);
Button btnStart = new ButtonBase(screen, new Vector2f(360f, 360f),
float startPointx = screen.getWidth() * 0.42f;
float startPointy = screen.getHeight() * 0.80f;
btnStart = new ButtonBase(screen, new Vector2f(startPointx, startPointy),
new Vector2f(200f, 30f)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.start();
}
};
btnStart.setText("Start Game");
btnStart.setText("Launch");
btnStart.setTextAlign(BitmapFont.Align.Center);
pnlStart.addChild(btnStart);
this.addChild(pnlStart);
this.addChild(btnStart);
}
public void setStart() {
pnlStart.hide();
btnStart.hide();
}
public void setWait() {
pnlStart.show();
btnStart.show();
}
public void attach() {

View File

@ -20,7 +20,6 @@ import com.jme3.font.BitmapFont;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector2f;
import org.wyrez.shootingstars.gui.controls.IndicatorBase;
import org.wyrez.shootingstars.gui.controls.PanelBase;
import org.wyrez.shootingstars.states.util.LoadingProgress;
import tonegod.gui.controls.extras.Indicator;
import tonegod.gui.controls.text.Label;
@ -41,26 +40,24 @@ public class LoadingGui extends Panel {
this.setIgnoreMouse(true);
this.setIsVisible(false);
create();
this.resize(screen.getWidth(), screen.getHeight(), Borders.SE);
}
private void create() {
Panel panel = new PanelBase(screen, new Vector2f(15, 15), new Vector2f(800, 500));
panel.setIgnoreMouse(true);
float startPointx = screen.getWidth() * 0.42f;
float startPointy = screen.getHeight() * 0.80f;
indProgress = new IndicatorBase(screen, new Vector2f(360f, 360f),
indProgress = new IndicatorBase(screen, new Vector2f(startPointx, startPointy),
new Vector2f(200f, 30f), Indicator.Orientation.HORIZONTAL);
indProgress.setDisplayValues();
indProgress.setMaxValue(LoadingProgress.getProgressCount());
indProgress.setIndicatorColor(ColorRGBA.Black);
lblStatus = new Label(screen, new Vector2f(360f, 400f), new Vector2f(200f, 30f));
lblStatus = new Label(screen, new Vector2f(startPointx, startPointy + (screen.getHeight() * 0.05f)), new Vector2f(200f, 30f));
lblStatus.setTextAlign(BitmapFont.Align.Center);
panel.addChild(indProgress);
panel.addChild(lblStatus);
this.addChild(panel);
this.addChild(indProgress);
this.addChild(lblStatus);
}
public void attach() {

View File

@ -19,9 +19,9 @@ 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.controls.PanelBase;
import org.wyrez.shootingstars.gui.listener.MenuListener;
import tonegod.gui.controls.buttons.Button;
import tonegod.gui.controls.text.Label;
import tonegod.gui.controls.windows.Panel;
import tonegod.gui.core.Screen;
@ -39,33 +39,43 @@ public class MenuGUI extends Panel implements Gui {
this.setIgnoreMouse(true);
this.setIsVisible(false);
create();
this.resize(screen.getWidth(), screen.getHeight(), Borders.SE);
}
private void create() {
Panel panel = new PanelBase(screen, new Vector2f(15, 15), new Vector2f(800, 500));
panel.setIgnoreMouse(true);
float startPointx = screen.getWidth() * 0.2f;
float startPointy = screen.getHeight() * 0.35f;
float labelFontSize = screen.getWidth() * 0.07f;
float buttonLabelDistancex = screen.getWidth() * 0.5f;
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));
lblShootingStars.setFontSize(labelFontSize);
lblShootingStars.setText("Shooting Stars");
Button btnExit = new ButtonBase(screen, new Vector2f(600, 400), new Vector2f(120, 40)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.exitGame();
}
};
btnExit.setText("Exit");
Button btnStart = new ButtonBase(screen, new Vector2f(600, 300), new Vector2f(120, 40)) {
Button btnStart = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + (screen.getHeight() * 0.03f)), new Vector2f(160, 40)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.startGame();
}
};
btnStart.setText("Start");
btnStart.setText("Start Game");
Button btnExit = new ButtonBase(screen, new Vector2f(startPointx + buttonLabelDistancex, startPointy + (screen.getHeight() * 0.125f)), new Vector2f(160, 40)) {
@Override
public void onButtonMouseLeftUp(MouseButtonEvent evt, boolean toggled) {
listener.exitGame();
}
};
btnExit.setText("Exit Game");
panel.addChild(btnStart);
panel.addChild(btnExit);
this.addChild(panel);
this.addChild(btnStart);
this.addChild(btnExit);
this.addChild(lblWyrez);
this.addChild(lblShootingStars);
}
public void attach() {