private void saveSettings() { Dimension resolution = DefaultSettings.RESOLUTIONS[cbxResolution.getSelectedIndex()]; Settings.set("resolution_width", (int) resolution.getWidth()); Settings.set("resolution_height", (int) resolution.getHeight()); Settings.set("fullscreen", cbxFullscreen.isSelected()); Settings.set( "antialiasing", DefaultSettings.ANTIALIASING_SAMPLES[cbxAntialiasing.getSelectedIndex()]); Settings.set("vsync", cbxVSync.isSelected()); Settings.set("hardware_skinning", cbxHardwareSkinning.isSelected()); Settings.set("shadow_quality", sldShadowQuality.getValue()); Settings.saveFile(); }
private void loadSettings() { for (int i = 0; i < DefaultSettings.RESOLUTIONS.length; i++) { Dimension resolution = DefaultSettings.RESOLUTIONS[i]; cbxResolution.addItem(getResolutionString(resolution)); if ((resolution.getWidth() == Settings.getInteger("resolution_width")) && (resolution.getHeight() == Settings.getInteger("resolution_height"))) { cbxResolution.setSelectedIndex(i); } } cbxFullscreen.setSelected(Settings.getBoolean("fullscreen")); for (int i = 0; i < DefaultSettings.ANTIALIASING_SAMPLES.length; i++) { int antiAliasingSamples = DefaultSettings.ANTIALIASING_SAMPLES[i]; cbxAntialiasing.addItem( (antiAliasingSamples != 0) ? antiAliasingSamples + "x" : "Deactivated"); if (antiAliasingSamples == Settings.getInteger("antialiasing")) { cbxAntialiasing.setSelectedIndex(i); } } cbxVSync.setSelected(Settings.getBoolean("vsync")); cbxHardwareSkinning.setSelected(Settings.getBoolean("hardware_skinning")); sldShadowQuality.setValue(Settings.getInteger("shadow_quality")); }