public void storePreferences() { ISettingsManager props = properties; props.setOptionsSoundEnableSound(getEnableSoundCheckBox().isSelected()); props.setOptionsSoundEnableGunshot(getEnableGunshotCheckBox().isSelected()); props.setOptionsSoundEnableBulletHit(getEnableBulletHitCheckBox().isSelected()); props.setOptionsSoundEnableRobotDeath(getEnableRobotDeathCheckBox().isSelected()); props.setOptionsSoundEnableRobotCollision(getEnableRobotCollisionCheckBox().isSelected()); props.setOptionsSoundEnableWallCollision(getEnableWallCollisionCheckBox().isSelected()); props.setOptionsSoundEnableMixerVolume(getEnableMixerVolumeCheckBox().isSelected()); props.setOptionsSoundEnableMixerPan(getEnableMixerPanCheckBox().isSelected()); String mixerClassName = null; Mixer.Info mixerInfo = (Mixer.Info) getMixerComboBox().getSelectedItem(); if (mixerInfo != null) { Mixer mixer = AudioSystem.getMixer((Mixer.Info) getMixerComboBox().getSelectedItem()); if (mixer != null) { mixerClassName = mixer.getClass().getSimpleName(); } } if (mixerClassName != null) { props.setOptionsSoundMixer(mixerClassName); } properties.saveProperties(); }
public void storePreferences() { ISettingsManager props = properties; props.setOptionsRenderingAntialiasing(optionsRenderingAntialiasingComboBox.getSelectedIndex()); props.setOptionsRenderingTextAntialiasing( optionsRenderingTextAntialiasingComboBox.getSelectedIndex()); props.setOptionsRenderingMethod(optionsRenderingMethodComboBox.getSelectedIndex()); props.setOptionsRenderingNoBuffers(optionsRenderingNoBuffersComboBox.getSelectedIndex() + 1); props.setOptionsRenderingBufferImages(optionsRenderingBufferImagesCheckBox.isSelected()); props.setOptionsRenderingForceBulletColor( optionsRenderingForceBulletColorCheckBox.isSelected()); properties.saveProperties(); }
public void run() { Thread.setDefaultUncaughtExceptionHandler( new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(Thread thread, Throwable t) { t.printStackTrace(); } }); try { hostManager.initSecurity(); // Set the Look and Feel (LAF) if (windowManager != null && windowManager.isGUIEnabled()) { windowManager.init(); } properties.setOptionsBattleDesiredTPS(setup.tps); battleManager.addListener(battleObserver); if (windowManager != null && windowManager.isGUIEnabled()) { if (!setup.minimize && setup.battleFilename == null && soundManager != null) { soundManager.playThemeMusic(); windowManager.showSplashScreen(); } windowManager.showRobocodeFrame(true, setup.minimize); windowManager.showBarCodeScanDialog(true); // Play the intro battle if a battle file is not specified and this is the first time // Robocode is being run if (setup.battleFilename == null && versionManager.isLastRunVersionChanged()) { properties.saveProperties(); windowManager.runIntroBattle(); } } final boolean enableCLIRecording = (setup.recordFilename != null || setup.recordXmlFilename != null); // Note: At this point the GUI should be opened (if enabled) before starting the battle from a // battle file if (setup.battleFilename != null) { if (setup.replayFilename != null) { System.err.println( "You cannot run both a battle and replay a battle record in the same time."); System.exit(8); } setup.exitOnComplete = true; battleManager.setBattleFilename(setup.battleFilename); if (new File(battleManager.getBattleFilename()).exists()) { battleManager.startNewBattle( battleManager.loadBattleProperties(), false, enableCLIRecording); } else { System.err.println( "The specified battle file '" + setup.battleFilename + "' was not found"); System.exit(8); } } else if (setup.replayFilename != null) { setup.exitOnComplete = true; if (setup.replayFilename.toLowerCase().endsWith("xml.zip")) { recordManager.loadRecord(setup.replayFilename, BattleRecordFormat.XML_ZIP); } else { recordManager.loadRecord(setup.replayFilename, BattleRecordFormat.BINARY_ZIP); } if (new File(setup.replayFilename).exists()) { battleManager.replay(); } else { System.err.println( "The specified battle record file '" + setup.replayFilename + "' was not found"); System.exit(8); } } } catch (Throwable e) { Logger.logError(e); } }