extend optionsettings, improve gamegui
This commit is contained in:
parent
6237be844f
commit
eda2de7c8e
@ -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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
|||||||
@ -43,7 +43,6 @@ public class GameGUI extends Panel {
|
|||||||
private Button btnStart;
|
private Button btnStart;
|
||||||
private Button btnResume;
|
private Button btnResume;
|
||||||
private Button btnMenu;
|
private Button btnMenu;
|
||||||
private Picture picCrosshair;
|
|
||||||
private Dial indOverheat;
|
private Dial indOverheat;
|
||||||
private AssetManager assetManager;
|
private AssetManager assetManager;
|
||||||
private Spatial player;
|
private Spatial player;
|
||||||
@ -105,29 +104,16 @@ public class GameGUI extends Panel {
|
|||||||
btnMenu.setTextAlign(BitmapFont.Align.Center);
|
btnMenu.setTextAlign(BitmapFont.Align.Center);
|
||||||
btnMenu.setFontSize(labelFontSize);
|
btnMenu.setFontSize(labelFontSize);
|
||||||
|
|
||||||
picCrosshair = new Picture("Crosshair");
|
indOverheat = new Dial(screen, new Vector2f(0f, 0f)) {
|
||||||
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
|
@Override
|
||||||
public void onChange(int arg0, Object arg1) {
|
public void onChange(int arg0, Object arg1) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
indOverheat.setGapStartAngle(60);
|
indOverheat.setGapStartAngle(60);
|
||||||
indOverheat.setGapEndAngle(296);
|
indOverheat.setGapEndAngle(296);
|
||||||
indOverheat.setWidth(screenHelper.calcX(50f));
|
indOverheat.setDimensions(screenHelper.calcX(50f), screenHelper.calcY(50f));
|
||||||
indOverheat.setHeight(screenHelper.calcY(50f));
|
|
||||||
indOverheat.centerToParent();
|
indOverheat.centerToParent();
|
||||||
indOverheat.setDialImageBackground("Textures/empty.png");
|
indOverheat.setDialImageBackground("Textures/crosshair.png");
|
||||||
indOverheat.setDialImageIndicator("Textures/heat_ind.png");
|
indOverheat.setDialImageIndicator("Textures/heat_ind.png");
|
||||||
updateOverhead(0f);
|
updateOverhead(0f);
|
||||||
|
|
||||||
@ -139,12 +125,10 @@ public class GameGUI extends Panel {
|
|||||||
this.addChild(btnResume);
|
this.addChild(btnResume);
|
||||||
this.addChild(btnMenu);
|
this.addChild(btnMenu);
|
||||||
this.addChild(indOverheat);
|
this.addChild(indOverheat);
|
||||||
this.addChild(pnlCrosshair);
|
|
||||||
this.addChild(lblPoints);
|
this.addChild(lblPoints);
|
||||||
|
|
||||||
btnResume.hide();
|
btnResume.hide();
|
||||||
btnMenu.hide();
|
btnMenu.hide();
|
||||||
picCrosshair.setCullHint(CullHint.Always);
|
|
||||||
indOverheat.hide();
|
indOverheat.hide();
|
||||||
lblPoints.hide();
|
lblPoints.hide();
|
||||||
}
|
}
|
||||||
@ -153,7 +137,6 @@ public class GameGUI extends Panel {
|
|||||||
btnStart.hide();
|
btnStart.hide();
|
||||||
btnResume.hide();
|
btnResume.hide();
|
||||||
btnMenu.hide();
|
btnMenu.hide();
|
||||||
picCrosshair.setCullHint(CullHint.Inherit);
|
|
||||||
indOverheat.show();
|
indOverheat.show();
|
||||||
lblPoints.show();
|
lblPoints.show();
|
||||||
}
|
}
|
||||||
@ -162,7 +145,6 @@ public class GameGUI extends Panel {
|
|||||||
btnStart.show();
|
btnStart.show();
|
||||||
btnResume.hide();
|
btnResume.hide();
|
||||||
btnMenu.hide();
|
btnMenu.hide();
|
||||||
picCrosshair.setCullHint(CullHint.Always);
|
|
||||||
indOverheat.hide();
|
indOverheat.hide();
|
||||||
lblPoints.hide();
|
lblPoints.hide();
|
||||||
}
|
}
|
||||||
@ -171,7 +153,6 @@ public class GameGUI extends Panel {
|
|||||||
btnStart.hide();
|
btnStart.hide();
|
||||||
btnResume.show();
|
btnResume.show();
|
||||||
btnMenu.show();
|
btnMenu.show();
|
||||||
picCrosshair.setCullHint(CullHint.Always);
|
|
||||||
indOverheat.hide();
|
indOverheat.hide();
|
||||||
lblPoints.hide();
|
lblPoints.hide();
|
||||||
}
|
}
|
||||||
@ -180,7 +161,6 @@ public class GameGUI extends Panel {
|
|||||||
btnStart.hide();
|
btnStart.hide();
|
||||||
btnResume.hide();
|
btnResume.hide();
|
||||||
btnMenu.hide();
|
btnMenu.hide();
|
||||||
picCrosshair.setCullHint(CullHint.Inherit);
|
|
||||||
indOverheat.show();
|
indOverheat.show();
|
||||||
lblPoints.show();
|
lblPoints.show();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,6 +50,7 @@ public class LoadingGui extends Panel {
|
|||||||
float startPointx = screenHelper.calcX(537f);
|
float startPointx = screenHelper.calcX(537f);
|
||||||
float startPointy = screenHelper.calcY(576f);
|
float startPointy = screenHelper.calcY(576f);
|
||||||
float distancePogressbarLabely = screenHelper.calcY(36f);
|
float distancePogressbarLabely = screenHelper.calcY(36f);
|
||||||
|
float labelFontSize = screenHelper.calcX(20f);
|
||||||
|
|
||||||
indProgress = new IndicatorBase(screen, new Vector2f(startPointx, startPointy),
|
indProgress = new IndicatorBase(screen, new Vector2f(startPointx, startPointy),
|
||||||
new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)), Indicator.Orientation.HORIZONTAL);
|
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 = new Label(screen, new Vector2f(startPointx, startPointy + distancePogressbarLabely), new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)));
|
||||||
lblStatus.setTextAlign(BitmapFont.Align.Center);
|
lblStatus.setTextAlign(BitmapFont.Align.Center);
|
||||||
|
lblStatus.setFontSize(labelFontSize);
|
||||||
|
|
||||||
this.addChild(indProgress);
|
this.addChild(indProgress);
|
||||||
this.addChild(lblStatus);
|
this.addChild(lblStatus);
|
||||||
|
|||||||
@ -45,6 +45,7 @@ public class OptionsGUI extends Panel implements Gui {
|
|||||||
|
|
||||||
//General Controls
|
//General Controls
|
||||||
private TextField txtPlayerName;
|
private TextField txtPlayerName;
|
||||||
|
private CheckBox chkEnableAudioVisualization;
|
||||||
|
|
||||||
//Video Controls
|
//Video Controls
|
||||||
private ComboBox cboResolution;
|
private ComboBox cboResolution;
|
||||||
@ -119,6 +120,10 @@ public class OptionsGUI extends Panel implements Gui {
|
|||||||
float startPointx = screenHelper.calcX(64f);
|
float startPointx = screenHelper.calcX(64f);
|
||||||
float startPointy = screenHelper.calcY(36f);
|
float startPointy = screenHelper.calcY(36f);
|
||||||
float marginLeftControls = screenHelper.calcX(115.8f);
|
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)));
|
Label lblPlayerName = new Label(screen, new Vector2f(startPointx, startPointy), new Vector2f(screenHelper.calcX(120f), screenHelper.calcY(40f)));
|
||||||
lblPlayerName.setText("Player Name");
|
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 = new TextField(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(7f)), new Vector2f(screenHelper.calcX(200f), screenHelper.calcY(30f)));
|
||||||
txtPlayerName.setFontSize(labelFontSize);
|
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(lblPlayerName);
|
||||||
this.addChild(txtPlayerName);
|
this.addChild(txtPlayerName);
|
||||||
|
this.addChild(lblEnableAudioVisualization);
|
||||||
|
this.addChild(chkEnableAudioVisualization);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createVideo(float labelFontSize) {
|
private void createVideo(float labelFontSize) {
|
||||||
@ -277,13 +290,14 @@ public class OptionsGUI extends Panel implements Gui {
|
|||||||
|
|
||||||
//General
|
//General
|
||||||
txtPlayerName.setText(settings.getUsername());
|
txtPlayerName.setText(settings.getUsername());
|
||||||
|
chkEnableAudioVisualization.setIsChecked(settings.isAudioVisualizationEnabled());
|
||||||
|
|
||||||
//Video
|
//Video
|
||||||
setComboBoxValue(cboResolution, resolution);
|
setComboBoxValue(cboResolution, resolution);
|
||||||
setComboBoxValue(cboFrequency, String.valueOf(settings.getFrequency()));
|
setComboBoxValue(cboFrequency, String.valueOf(settings.getFrequency()));
|
||||||
chkFullscreen.setIsChecked(settings.isFullscreenEnabled());
|
chkFullscreen.setIsChecked(settings.isFullscreenEnabled());
|
||||||
chkVSync.setIsChecked(settings.isVSyncEnabled());
|
chkVSync.setIsChecked(settings.isVSyncEnabled());
|
||||||
chkShowWeapon.setIsChecked(settings.isShowWeaponEnabled());
|
chkShowWeapon.setIsChecked(settings.isShowWeaponEnabled());
|
||||||
sldParticleDensity.setSelectedIndex(settings.getParticleDensity());
|
sldParticleDensity.setSelectedIndex(settings.getParticleDensity());
|
||||||
|
|
||||||
//Audio
|
//Audio
|
||||||
@ -303,6 +317,7 @@ public class OptionsGUI extends Panel implements Gui {
|
|||||||
private void saveControlValues() {
|
private void saveControlValues() {
|
||||||
//General
|
//General
|
||||||
settings.setUsername(txtPlayerName.getText());
|
settings.setUsername(txtPlayerName.getText());
|
||||||
|
settings.setEnableAudioVisualization(chkEnableAudioVisualization.getIsChecked());
|
||||||
|
|
||||||
//Video
|
//Video
|
||||||
String resolution[] = cboResolution.getSelectedListItem().getValue().toString().split(" x ");
|
String resolution[] = cboResolution.getSelectedListItem().getValue().toString().split(" x ");
|
||||||
|
|||||||
@ -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;
|
package org.wyrez.shootingstars.helper;
|
||||||
|
|
||||||
import tonegod.gui.core.Screen;
|
import tonegod.gui.core.Screen;
|
||||||
|
|||||||
@ -104,6 +104,10 @@ public class OptionSettings {
|
|||||||
public void setShowWeapon(boolean enabled) {
|
public void setShowWeapon(boolean enabled) {
|
||||||
settings.putBoolean("ShowWeapon", enabled);
|
settings.putBoolean("ShowWeapon", enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEnableAudioVisualization(boolean enabled) {
|
||||||
|
settings.putBoolean("EnableAudioVisualization", enabled);
|
||||||
|
}
|
||||||
|
|
||||||
public void setFullscreen(boolean enabled) {
|
public void setFullscreen(boolean enabled) {
|
||||||
settings.setFullscreen(enabled);
|
settings.setFullscreen(enabled);
|
||||||
@ -164,6 +168,10 @@ public class OptionSettings {
|
|||||||
public boolean isShowWeaponEnabled() {
|
public boolean isShowWeaponEnabled() {
|
||||||
return settings.getBoolean("ShowWeapon");
|
return settings.getBoolean("ShowWeapon");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAudioVisualizationEnabled() {
|
||||||
|
return settings.getBoolean("EnableAudioVisualization");
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isFullscreenEnabled() {
|
public boolean isFullscreenEnabled() {
|
||||||
return settings.isFullscreen();
|
return settings.isFullscreen();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user