extend optionsettings, improve gamegui

This commit is contained in:
TheCodeBoat 2013-06-28 08:07:18 +02:00
parent 6237be844f
commit eda2de7c8e
9 changed files with 49 additions and 28 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 Darth Affe <http://wyrez.org> and contributors
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 Darth Affe <http://wyrez.org> and contributors
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 Darth Affe <http://wyrez.org> and contributors
* 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

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2013 Darth Affe <http://wyrez.org> and contributors
* 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

View File

@ -43,7 +43,6 @@ public class GameGUI extends Panel {
private Button btnStart;
private Button btnResume;
private Button btnMenu;
private Picture picCrosshair;
private Dial indOverheat;
private AssetManager assetManager;
private Spatial player;
@ -105,29 +104,16 @@ public class GameGUI extends Panel {
btnMenu.setTextAlign(BitmapFont.Align.Center);
btnMenu.setFontSize(labelFontSize);
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()) {
indOverheat = new Dial(screen, new Vector2f(0f, 0f)) {
@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.setDimensions(screenHelper.calcX(50f), screenHelper.calcY(50f));
indOverheat.centerToParent();
indOverheat.setDialImageBackground("Textures/empty.png");
indOverheat.setDialImageBackground("Textures/crosshair.png");
indOverheat.setDialImageIndicator("Textures/heat_ind.png");
updateOverhead(0f);
@ -139,12 +125,10 @@ public class GameGUI extends Panel {
this.addChild(btnResume);
this.addChild(btnMenu);
this.addChild(indOverheat);
this.addChild(pnlCrosshair);
this.addChild(lblPoints);
btnResume.hide();
btnMenu.hide();
picCrosshair.setCullHint(CullHint.Always);
indOverheat.hide();
lblPoints.hide();
}
@ -153,7 +137,6 @@ public class GameGUI extends Panel {
btnStart.hide();
btnResume.hide();
btnMenu.hide();
picCrosshair.setCullHint(CullHint.Inherit);
indOverheat.show();
lblPoints.show();
}
@ -162,7 +145,6 @@ public class GameGUI extends Panel {
btnStart.show();
btnResume.hide();
btnMenu.hide();
picCrosshair.setCullHint(CullHint.Always);
indOverheat.hide();
lblPoints.hide();
}
@ -171,7 +153,6 @@ public class GameGUI extends Panel {
btnStart.hide();
btnResume.show();
btnMenu.show();
picCrosshair.setCullHint(CullHint.Always);
indOverheat.hide();
lblPoints.hide();
}
@ -180,7 +161,6 @@ public class GameGUI extends Panel {
btnStart.hide();
btnResume.hide();
btnMenu.hide();
picCrosshair.setCullHint(CullHint.Inherit);
indOverheat.show();
lblPoints.show();
}

View File

@ -50,6 +50,7 @@ public class LoadingGui extends Panel {
float startPointx = screenHelper.calcX(537f);
float startPointy = screenHelper.calcY(576f);
float distancePogressbarLabely = screenHelper.calcY(36f);
float labelFontSize = screenHelper.calcX(20f);
indProgress = new IndicatorBase(screen, new Vector2f(startPointx, startPointy),
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)), Indicator.Orientation.HORIZONTAL);
@ -59,6 +60,7 @@ public class LoadingGui extends Panel {
lblStatus = new Label(screen, new Vector2f(startPointx, startPointy + distancePogressbarLabely), new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)));
lblStatus.setTextAlign(BitmapFont.Align.Center);
lblStatus.setFontSize(labelFontSize);
this.addChild(indProgress);
this.addChild(lblStatus);

View File

@ -45,6 +45,7 @@ public class OptionsGUI extends Panel implements Gui {
//General Controls
private TextField txtPlayerName;
private CheckBox chkEnableAudioVisualization;
//Video Controls
private ComboBox cboResolution;
@ -119,6 +120,10 @@ public class OptionsGUI extends Panel implements Gui {
float startPointx = screenHelper.calcX(64f);
float startPointy = screenHelper.calcY(36f);
float marginLeftControls = screenHelper.calcX(115.8f);
float startPointAudioVisualx = screenHelper.calcX(464f);
float startPointAudioVisualy = screenHelper.calcY(36f);
float marginLeftAudioVisualControl = screenHelper.calcX(190f);
Label lblPlayerName = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
lblPlayerName.setText("Player Name");
@ -127,8 +132,16 @@ public class OptionsGUI extends Panel implements Gui {
txtPlayerName = new TextField(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(7f)), new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)));
txtPlayerName.setFontSize(labelFontSize);
Label lblEnableAudioVisualization = new Label(screen, new Vector2f(startPointAudioVisualx, startPointAudioVisualy), new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(40f)));
lblEnableAudioVisualization.setText("Enable Audio Visualization");
lblEnableAudioVisualization.setFontSize(labelFontSize);
chkEnableAudioVisualization = new CheckBox(screen, new Vector2f(startPointAudioVisualx + marginLeftAudioVisualControl, startPointAudioVisualy + screenHelper.calcY(12f)), new Vector2f(screenHelper.calcX(20f), screenHelper.calcX(20f)));
this.addChild(lblPlayerName);
this.addChild(txtPlayerName);
this.addChild(lblEnableAudioVisualization);
this.addChild(chkEnableAudioVisualization);
}
private void createVideo(float labelFontSize) {
@ -277,13 +290,14 @@ public class OptionsGUI extends Panel implements Gui {
//General
txtPlayerName.setText(settings.getUsername());
chkEnableAudioVisualization.setIsChecked(settings.isAudioVisualizationEnabled());
//Video
setComboBoxValue(cboResolution, resolution);
setComboBoxValue(cboFrequency, String.valueOf(settings.getFrequency()));
chkFullscreen.setIsChecked(settings.isFullscreenEnabled());
chkVSync.setIsChecked(settings.isVSyncEnabled());
chkShowWeapon.setIsChecked(settings.isShowWeaponEnabled());
chkShowWeapon.setIsChecked(settings.isShowWeaponEnabled());
sldParticleDensity.setSelectedIndex(settings.getParticleDensity());
//Audio
@ -303,6 +317,7 @@ public class OptionsGUI extends Panel implements Gui {
private void saveControlValues() {
//General
settings.setUsername(txtPlayerName.getText());
settings.setEnableAudioVisualization(chkEnableAudioVisualization.getIsChecked());
//Video
String resolution[] = cboResolution.getSelectedListItem().getValue().toString().split(" x ");

View File

@ -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.helper;
import tonegod.gui.core.Screen;

View File

@ -104,6 +104,10 @@ public class OptionSettings {
public void setShowWeapon(boolean enabled) {
settings.putBoolean("ShowWeapon", enabled);
}
public void setEnableAudioVisualization(boolean enabled) {
settings.putBoolean("EnableAudioVisualization", enabled);
}
public void setFullscreen(boolean enabled) {
settings.setFullscreen(enabled);
@ -164,6 +168,10 @@ public class OptionSettings {
public boolean isShowWeaponEnabled() {
return settings.getBoolean("ShowWeapon");
}
public boolean isAudioVisualizationEnabled() {
return settings.getBoolean("EnableAudioVisualization");
}
public boolean isFullscreenEnabled() {
return settings.isFullscreen();