From 14ef7b4b58fcb0e6ae537c86426f9bbe81fb2b9c Mon Sep 17 00:00:00 2001 From: Andrey Shapovalov Date: Thu, 25 Nov 2021 11:54:35 +0300 Subject: [PATCH] Center Lines and guides color change --- gradle.properties | 2 +- src/main/java/mchorse/aperture/Aperture.java | 13 ++++++++----- .../aperture/client/gui/GuiCameraEditor.java | 8 +++++++- .../client/gui/config/GuiConfigCameraOptions.java | 11 ++++++++++- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/gradle.properties b/gradle.properties index 6eea6154..2899a7af 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ # Aperture gradle properties version=1.7 mclib=2.3.6 -minema=3.6 +minema=3.6.1 mc_version=1.12.2 forge_version=14.23.3.2655 diff --git a/src/main/java/mchorse/aperture/Aperture.java b/src/main/java/mchorse/aperture/Aperture.java index 6a087e1b..dd406e47 100644 --- a/src/main/java/mchorse/aperture/Aperture.java +++ b/src/main/java/mchorse/aperture/Aperture.java @@ -2,13 +2,10 @@ import mchorse.aperture.commands.CommandAperture; import mchorse.mclib.McLib; +import mchorse.mclib.client.gui.utils.ValueColors; import mchorse.mclib.commands.utils.L10n; import mchorse.mclib.config.ConfigBuilder; -import mchorse.mclib.config.values.ValueBoolean; -import mchorse.mclib.config.values.ValueFloat; -import mchorse.mclib.config.values.ValueInt; -import mchorse.mclib.config.values.ValueRL; -import mchorse.mclib.config.values.ValueString; +import mchorse.mclib.config.values.*; import mchorse.mclib.events.RegisterConfigEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; @@ -76,7 +73,11 @@ public class Aperture public static ValueRL editorOverlayRL; public static ValueBoolean editorF1Tooltip; public static ValueBoolean editorDisplayPosition; + + public static ValueInt editorGuidesColor; public static ValueBoolean editorRuleOfThirds; + public static ValueBoolean editorCenterLines; + public static ValueBoolean editorCrosshair; public static ValueBoolean editorLetterbox; public static ValueString editorLetterboxAspect; @@ -156,7 +157,9 @@ public void onConfigRegister(RegisterConfigEvent event) editorOverlayRL = builder.getRL("overlay_rl", null); editorF1Tooltip = builder.getBoolean("f1_tooltip", true); editorDisplayPosition = builder.getBoolean("position", false); + editorGuidesColor = builder.getInt("guides_color",0xcccc0000); editorRuleOfThirds = builder.getBoolean("rule_of_thirds", false); + editorCenterLines = builder.getBoolean("center_lines", false); editorCrosshair = builder.getBoolean("crosshair", false); editorLetterbox = builder.getBoolean("letter_box", false); editorLetterboxAspect = builder.getString("aspect_ratio", "21:9"); diff --git a/src/main/java/mchorse/aperture/client/gui/GuiCameraEditor.java b/src/main/java/mchorse/aperture/client/gui/GuiCameraEditor.java index 3bbc2714..2ab82130 100644 --- a/src/main/java/mchorse/aperture/client/gui/GuiCameraEditor.java +++ b/src/main/java/mchorse/aperture/client/gui/GuiCameraEditor.java @@ -1604,7 +1604,7 @@ private void drawOverlays() if (Aperture.editorRuleOfThirds.get()) { - int color = 0xcccc0000; + int color = Aperture.editorGuidesColor.get(); Gui.drawRect(rx + rw / 3 - 1, ry, rx + rw / 3, ry + rh, color); Gui.drawRect(rx + rw - rw / 3, ry, rx + rw - rw / 3 + 1, ry + rh, color); @@ -1612,6 +1612,12 @@ private void drawOverlays() Gui.drawRect(rx, ry + rh / 3 - 1, rx + rw, ry + rh / 3, color); Gui.drawRect(rx, ry + rh - rh / 3, rx + rw, ry + rh - rh / 3 + 1, color); } + if(Aperture.editorCenterLines.get()) + { + int color = Aperture.editorGuidesColor.get(); + this.drawHorizontalLine(0,this.width,this.height/2,color); + this.drawVerticalLine(this.width/2,0,this.height,color); + } if (Aperture.editorCrosshair.get()) { diff --git a/src/main/java/mchorse/aperture/client/gui/config/GuiConfigCameraOptions.java b/src/main/java/mchorse/aperture/client/gui/config/GuiConfigCameraOptions.java index 4a356260..13255281 100644 --- a/src/main/java/mchorse/aperture/client/gui/config/GuiConfigCameraOptions.java +++ b/src/main/java/mchorse/aperture/client/gui/config/GuiConfigCameraOptions.java @@ -7,9 +7,11 @@ import mchorse.mclib.client.gui.framework.elements.IGuiElement; import mchorse.mclib.client.gui.framework.elements.buttons.GuiButtonElement; import mchorse.mclib.client.gui.framework.elements.buttons.GuiToggleElement; +import mchorse.mclib.client.gui.framework.elements.input.GuiColorElement; import mchorse.mclib.client.gui.framework.elements.input.GuiTextElement; import mchorse.mclib.client.gui.framework.elements.input.GuiTexturePicker; import mchorse.mclib.client.gui.utils.keys.IKey; +import mchorse.mclib.utils.Color; import net.minecraft.client.Minecraft; public class GuiConfigCameraOptions extends GuiAbstractConfigOptions @@ -21,7 +23,9 @@ public class GuiConfigCameraOptions extends GuiAbstractConfigOptions public GuiToggleElement flight; public GuiToggleElement displayPosition; public GuiToggleElement essentialsTeleport; + public GuiColorElement guidesColor; public GuiToggleElement ruleOfThirds; + public GuiToggleElement centerLines; public GuiToggleElement crosshair; public GuiToggleElement letterBox; public GuiTextElement aspectRatio; @@ -60,7 +64,10 @@ public GuiConfigCameraOptions(Minecraft mc, GuiCameraEditor editor) this.displayPosition = new GuiToggleElement(mc, Aperture.editorDisplayPosition); this.essentialsTeleport = new GuiToggleElement(mc, Aperture.essentialsTeleport); + this.guidesColor = new GuiColorElement(mc, Aperture.editorGuidesColor); + this.guidesColor.picker.editAlpha = true; this.ruleOfThirds = new GuiToggleElement(mc, Aperture.editorRuleOfThirds); + this.centerLines = new GuiToggleElement(mc, Aperture.editorCenterLines); this.crosshair = new GuiToggleElement(mc, Aperture.editorCrosshair); this.letterBox = new GuiToggleElement(mc, Aperture.editorLetterbox); this.aspectRatio = new GuiTextElement(mc, Aperture.editorLetterboxAspect, this.editor::setAspectRatio); @@ -86,7 +93,7 @@ public GuiConfigCameraOptions(Minecraft mc, GuiCameraEditor editor) this.overlayPicker.flex().relative(this.editor.viewport).wh(1F, 1F); this.hideChat = new GuiToggleElement(mc, Aperture.editorHideChat); - this.add(this.outside, this.spectator, this.renderPath, this.sync, this.flight, this.displayPosition, this.ruleOfThirds, this.crosshair, this.letterBox, this.aspectRatio, this.loop, this.overlay, this.pickOverlay, this.hideChat); + this.add(this.outside, this.spectator, this.renderPath, this.sync, this.flight, this.displayPosition, this.guidesColor, this.ruleOfThirds, this.centerLines, this.crosshair, this.letterBox, this.aspectRatio, this.loop, this.overlay, this.pickOverlay, this.hideChat); if (!mc.isSingleplayer()) { @@ -113,7 +120,9 @@ public void update() this.flight.toggled(this.editor.flight.isFlightEnabled()); this.displayPosition.toggled(Aperture.editorDisplayPosition.get()); this.essentialsTeleport.toggled(Aperture.essentialsTeleport.get()); + this.guidesColor.picker.color = new Color(Aperture.editorGuidesColor.get()); this.ruleOfThirds.toggled(Aperture.editorRuleOfThirds.get()); + this.centerLines.toggled(Aperture.editorCenterLines.get()); this.crosshair.toggled(Aperture.editorCrosshair.get()); this.letterBox.toggled(Aperture.editorLetterbox.get()); this.aspectRatio.setText(Aperture.editorLetterboxAspect.get());