From dd68b1546d509a0a3565ef823a08b58b7d452963 Mon Sep 17 00:00:00 2001 From: CrushedPixel Date: Tue, 28 Jul 2015 00:00:38 +0200 Subject: [PATCH] The GuiRenderSettings loads their initial settings from the Replay Mod config Upon rendering, the GuiRenderSettings saves the current RenderOptions to the Replay Mod config --- .../replaymod/gui/GuiRenderSettings.java | 70 ++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java b/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java index 24fc9c09..d74c9a05 100644 --- a/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/GuiRenderSettings.java @@ -27,6 +27,7 @@ import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.List; public class GuiRenderSettings extends GuiScreen implements GuiReplayOverlay.NoOverlay { @@ -38,6 +39,9 @@ public class GuiRenderSettings extends GuiScreen implements GuiReplayOverlay.NoO private static final int LEFT_BORDER = 10; + private final RenderOptions initialRenderOptions = RenderOptions.loadFromConfig(ReplayMod.config); + private boolean initialized = false; + private GuiAdvancedButton renderButton = new GuiAdvancedButton(0, 0, 100, 20, I18n.format("replaymod.gui.render"), new Runnable() { @Override public void run() { @@ -224,7 +228,13 @@ public class GuiRenderSettings extends GuiScreen implements GuiReplayOverlay.NoO initializeAdvancedTab(); initializeCommandLineTab(); + if(!initialized) { + initializeValues(); + } + validateInputs(); + + initialized = true; } private void initializeVideoTab() { @@ -320,6 +330,62 @@ public class GuiRenderSettings extends GuiScreen implements GuiReplayOverlay.NoO ffmpegArguments.xPosition = commandInput.xPosition+commandInput.width+5; } + private void initializeValues() { + RendererSettings defRS = RendererSettings.valueOf(initialRenderOptions.getMode().name()); + + List settingsList = rendererDropdown.getAllElements(); + for(int i=0; i presetList = encodingPresetDropdown.getAllElements(); + if(preset != null) { + for(int i=0; i