This commit is contained in:
Raybz@Raybz 2013-06-21 16:13:19 +02:00
commit 830f1edb0b
3 changed files with 59 additions and 86 deletions

View File

@ -49,7 +49,6 @@ public class OptionsGUI extends Panel implements Gui {
//Video Controls
private ComboBox cboResolution;
private ComboBox cboFrequency;
private ComboBox cboDepthBits;
private CheckBox chkFullscreen;
private CheckBox chkVSync;
private CheckBox chkPostProcessing;
@ -81,23 +80,15 @@ public class OptionsGUI extends Panel implements Gui {
private void create() {
float tabControlStartPointx = screenHelper.calcX(32f);
float tabControlStartPointy = screenHelper.calcY(18f);
float witdhTabControl = screenHelper.calcX(1216f);
float heightTabControl = screenHelper.calcY(612f);
float buttonWidth = screenHelper.calcX(153.6f);
float buttonHeight = screenHelper.calcY(40f);
float labelFontSize = screenHelper.calcX(20f);
TabControl tcOptions = new TabControl(screen, "tcOptions", new Vector2f(tabControlStartPointx, tabControlStartPointy), new Vector2f(witdhTabControl, heightTabControl));
tcOptions.setUseSlideEffect(true);
tcOptions.addTab("General");
tcOptions.addTab("Video");
tcOptions.addTab("Audio");
createGeneralTab(tcOptions,labelFontSize);
createVideoTab(tcOptions,labelFontSize);
createAudioTab(tcOptions,labelFontSize);
createGeneral(labelFontSize);
createVideo(labelFontSize);
createAudio(labelFontSize);
float differnceTabControlButtons = screenHelper.calcY(622.8f);
@ -120,12 +111,11 @@ public class OptionsGUI extends Panel implements Gui {
btnCancel.setText("Cancel");
btnCancel.setFontSize(labelFontSize);
this.addChild(tcOptions);
this.addChild(btnSave);
this.addChild(btnCancel);
}
private void createGeneralTab(TabControl tcOptions, float labelFontSize) {
private void createGeneral(float labelFontSize) {
float startPointx = screenHelper.calcX(64f);
float startPointy = screenHelper.calcY(36f);
float marginLeftControls = screenHelper.calcX(115.8f);
@ -137,14 +127,14 @@ 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);
tcOptions.addTabChild(0, lblPlayerName);
tcOptions.addTabChild(0, txtPlayerName);
this.addChild(lblPlayerName);
this.addChild(txtPlayerName);
}
private void createVideoTab(TabControl tcOptions, float labelFontSize) {
private void createVideo(float labelFontSize) {
float startPointx = screenHelper.calcX(64f);
float startPointy = screenHelper.calcY(36f);
float startPointy = screenHelper.calcY(90f);
float marginLeftControls = screenHelper.calcX(115.8f);
float labelWitdh = screenHelper.calcX(120f);
float labelHeight = screenHelper.calcY(40f);
@ -158,11 +148,29 @@ public class OptionsGUI extends Panel implements Gui {
float sliderWitdh = screenHelper.calcX(200f);
float sliderHeight = screenHelper.calcY(30f);
Label lblResolution = new Label(screen, "lblResolution", new Vector2f(startPointx, startPointy), new Vector2f(labelWitdh, labelHeight));
Label lblFullscreen = new Label(screen, "lblFullscreen", new Vector2f(startPointx, startPointy), new Vector2f(labelWitdh, labelHeight));
lblFullscreen.setText("Fullscreen");
lblFullscreen.setFontSize(labelFontSize);
chkFullscreen = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(12f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
Label lblVSync = new Label(screen, "lblVSync", new Vector2f(startPointx + screenHelper.calcX(400f), startPointy), new Vector2f(labelWitdh, labelHeight));
lblVSync.setText("VSync");
lblVSync.setFontSize(labelFontSize);
chkVSync = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls + screenHelper.calcX(400f), startPointy + screenHelper.calcY(12f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
Label lblPostProcessing = new Label(screen, "lblPostProcessing", new Vector2f(startPointx + screenHelper.calcX(800f), startPointy), new Vector2f(labelWitdh, labelHeight));
lblPostProcessing.setText("PostProcessing");
lblPostProcessing.setFontSize(labelFontSize);
chkPostProcessing = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls + screenHelper.calcX(800f), startPointy + screenHelper.calcY(12f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
Label lblResolution = new Label(screen, "lblResolution", new Vector2f(startPointx, startPointy + screenHelper.calcY(50f)), new Vector2f(labelWitdh, labelHeight));
lblResolution.setText("Resolution");
lblResolution.setFontSize(labelFontSize);
cboResolution = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(7f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
cboResolution = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(57f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
@Override
public void onChange(int selectedIndex, Object value) {
}
@ -172,11 +180,11 @@ public class OptionsGUI extends Panel implements Gui {
cboResolution.addListItem(s, s);
}
Label lblFrequency = new Label(screen, "lblFrequency", new Vector2f(startPointx, startPointy + screenHelper.calcY(40f)), new Vector2f(labelWitdh, labelHeight));
Label lblFrequency = new Label(screen, "lblFrequency", new Vector2f(startPointx + screenHelper.calcX(400f), startPointy + screenHelper.calcY(50f)), new Vector2f(labelWitdh, labelHeight));
lblFrequency.setText("Frequency");
lblFrequency.setFontSize(labelFontSize);
cboFrequency = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(47f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
cboFrequency = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls + screenHelper.calcX(400f), startPointy + screenHelper.calcY(57f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
@Override
public void onChange(int selectedIndex, Object value) {
}
@ -186,43 +194,11 @@ public class OptionsGUI extends Panel implements Gui {
cboFrequency.addListItem(s, s);
}
Label lblDepthBits = new Label(screen, "lblDepthBits", new Vector2f(startPointx, startPointy + screenHelper.calcY(80f)), new Vector2f(labelWitdh, labelHeight));
lblDepthBits.setText("DepthBits");
lblDepthBits.setFontSize(labelFontSize);
cboDepthBits = new ComboBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(87f)), new Vector2f(comboBoxWidth, comboBoxHeight)) {
@Override
public void onChange(int selectedIndex, Object value) {
}
};
cboDepthBits.setFontSize(labelFontSize);
for (String s : DisplayHelper.getDepthBits()) {
cboDepthBits.addListItem(s, s);
}
Label lblFullscreen = new Label(screen, "lblFullscreen", new Vector2f(startPointx, startPointy + screenHelper.calcY(120f)), new Vector2f(labelWitdh, labelHeight));
lblFullscreen.setText("Fullscreen");
lblFullscreen.setFontSize(labelFontSize);
chkFullscreen = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(132f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
Label lblVSync = new Label(screen, "lblVSync", new Vector2f(startPointx, startPointy + screenHelper.calcY(160f)), new Vector2f(labelWitdh, labelHeight));
lblVSync.setText("VSync");
lblVSync.setFontSize(labelFontSize);
chkVSync = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(172f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
Label lblPostProcessing = new Label(screen, "lblPostProcessing", new Vector2f(startPointx, startPointy + screenHelper.calcY(200f)), new Vector2f(labelWitdh, labelHeight));
lblPostProcessing.setText("PostProcessing");
lblPostProcessing.setFontSize(labelFontSize);
chkPostProcessing = new CheckBox(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(212f)), new Vector2f(checkBoxWitdh, checkBoxHeight));
Label lblParticleDensity = new Label(screen, "lblParticleDensity", new Vector2f(startPointx, startPointy +screenHelper.calcY(240f)), new Vector2f(labelWitdh, labelHeight));
Label lblParticleDensity = new Label(screen, "lblParticleDensity", new Vector2f(startPointx + screenHelper.calcX(800f), startPointy +screenHelper.calcY(50f)), new Vector2f(labelWitdh, labelHeight));
lblParticleDensity.setText("ParticleDensity");
lblParticleDensity.setFontSize(labelFontSize);
sldParticleDensity = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(247f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
sldParticleDensity = new Slider(screen, new Vector2f(startPointx + marginLeftControls + screenHelper.calcX(800f), startPointy + screenHelper.calcY(57f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
@Override
public void onChange(int selectedIndex, Object value) {
}
@ -230,25 +206,23 @@ public class OptionsGUI extends Panel implements Gui {
sldParticleDensity.setStepIntegerRange(0, 3, 1);
tcOptions.addTabChild(1, lblVSync);
tcOptions.addTabChild(1, chkVSync);
tcOptions.addTabChild(1, lblFullscreen);
tcOptions.addTabChild(1, chkFullscreen);
tcOptions.addTabChild(1, lblDepthBits);
tcOptions.addTabChild(1, cboDepthBits);
tcOptions.addTabChild(1, lblFrequency);
tcOptions.addTabChild(1, cboFrequency);
tcOptions.addTabChild(1, lblResolution);
tcOptions.addTabChild(1, cboResolution);
tcOptions.addTabChild(1, lblPostProcessing);
tcOptions.addTabChild(1, chkPostProcessing);
tcOptions.addTabChild(1, lblParticleDensity);
tcOptions.addTabChild(1, sldParticleDensity);
this.addChild(lblVSync);
this.addChild(chkVSync);
this.addChild(lblFullscreen);
this.addChild(chkFullscreen);
this.addChild(lblFrequency);
this.addChild(cboFrequency);
this.addChild(lblResolution);
this.addChild(cboResolution);
this.addChild(lblPostProcessing);
this.addChild(chkPostProcessing);
this.addChild(lblParticleDensity);
this.addChild(sldParticleDensity);
}
private void createAudioTab(TabControl tcOptions, float labelFontSize) {
private void createAudio(float labelFontSize) {
float startPointx = screenHelper.calcX(64f);
float startPointy = screenHelper.calcY(36f);
float startPointy = screenHelper.calcY(290f);
float marginLeftControls = screenHelper.calcX(115.8f);
float labelWitdh = screenHelper.calcX(120f);
@ -268,34 +242,34 @@ public class OptionsGUI extends Panel implements Gui {
};
sldMasterVolume.setStepIntegerRange(0, 100, 1);
Label lblFXVolume = new Label(screen, "lblFXVolume", new Vector2f(startPointx, startPointy + screenHelper.calcY(40f)), new Vector2f(labelWitdh, labelHeight));
Label lblFXVolume = new Label(screen, "lblFXVolume", new Vector2f(startPointx + screenHelper.calcX(400f), startPointy), new Vector2f(labelWitdh, labelHeight));
lblFXVolume.setText("FXVolume");
lblFXVolume.setFontSize(labelFontSize);
sldFXVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(47f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
sldFXVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls + screenHelper.calcX(400f), startPointy + screenHelper.calcY(7f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
@Override
public void onChange(int selectedIndex, Object value) {
}
};
sldFXVolume.setStepIntegerRange(0, 100, 1);
Label lblSoundVolume = new Label(screen, "lblSoundVolume", new Vector2f(startPointx, startPointy + screenHelper.calcY(80f)), new Vector2f(labelWitdh, labelHeight));
Label lblSoundVolume = new Label(screen, "lblSoundVolume", new Vector2f(startPointx + screenHelper.calcX(800f), startPointy + screenHelper.calcY(0f)), new Vector2f(labelWitdh, labelHeight));
lblSoundVolume.setText("SoundVolume");
lblSoundVolume.setFontSize(labelFontSize);
sldSoundVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls, startPointy + screenHelper.calcY(87f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
sldSoundVolume = new Slider(screen, new Vector2f(startPointx + marginLeftControls + screenHelper.calcX(800f), startPointy + screenHelper.calcY(7f)), new Vector2f(sliderWitdh, sliderHeight), Slider.Orientation.HORIZONTAL, false) {
@Override
public void onChange(int selectedIndex, Object value) {
}
};
sldSoundVolume.setStepIntegerRange(0, 100, 1);
tcOptions.addTabChild(2, lblMasterVolume);
tcOptions.addTabChild(2, sldMasterVolume);
tcOptions.addTabChild(2, lblFXVolume);
tcOptions.addTabChild(2, sldFXVolume);
tcOptions.addTabChild(2, lblSoundVolume);
tcOptions.addTabChild(2, sldSoundVolume);
this.addChild(lblMasterVolume);
this.addChild(sldMasterVolume);
this.addChild(lblFXVolume);
this.addChild(sldFXVolume);
this.addChild(lblSoundVolume);
this.addChild(sldSoundVolume);
}
private void readControlValues() {
@ -307,7 +281,6 @@ public class OptionsGUI extends Panel implements Gui {
//Video
setComboBoxValue(cboResolution, resolution);
setComboBoxValue(cboFrequency, String.valueOf(settings.getFrequency()));
setComboBoxValue(cboDepthBits, String.valueOf(settings.getDepthBits()));
chkFullscreen.setIsChecked(settings.isFullscreenEnabled());
chkVSync.setIsChecked(settings.isVSyncEnabled());
chkPostProcessing.setIsChecked(settings.isPostprocessingEnabled());
@ -336,7 +309,6 @@ public class OptionsGUI extends Panel implements Gui {
settings.setWidth(Integer.parseInt(resolution[0]));
settings.setHeight(Integer.parseInt(resolution[1]));
settings.setFrequency(Integer.parseInt(cboFrequency.getSelectedListItem().getValue().toString()));
settings.setDepthBits(Integer.parseInt(cboDepthBits.getSelectedListItem().getValue().toString()));
settings.setFullscreen(chkFullscreen.getIsChecked());
settings.setVSync(chkVSync.getIsChecked());
settings.setPostProcessing(chkPostProcessing.getIsChecked());

View File

@ -64,6 +64,7 @@ public class OptionSettings {
setUsername("Player");
setPostProcessing(true);
setParticleDensity(3);
setDepthBits(24);
}
}