]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/commitdiff
Change button ON state highlighting to make it more obvious in 1.15+
authorIrtimaled <irtimaled@gmail.com>
Mon, 4 May 2020 07:41:07 +0000 (00:41 -0700)
committerIrtimaled <irtimaled@gmail.com>
Mon, 18 May 2020 00:28:01 +0000 (17:28 -0700)
src/main/java/com/irtimaled/bbor/client/gui/BoolButton.java
src/main/java/com/irtimaled/bbor/client/gui/BoundingBoxTypeButton.java

index 3b42bbe830576de41dadbba238e5c1aee6c8d6bb..df85436de219a6b8b7435acb33af8fcee8774260 100644 (file)
@@ -1,6 +1,10 @@
 package com.irtimaled.bbor.client.gui;
 
+import java.awt.*;
+
 public abstract class BoolButton extends AbstractButton {
+    private static final Color OVERLAY_COLOR = new Color(0, 255, 0, 48);
+
     private boolean value;
 
     BoolButton(int width, String label, boolean enabled) {
@@ -13,7 +17,7 @@ public abstract class BoolButton extends AbstractButton {
 
     @Override
     protected int getState() {
-        return enabled ? this.getValue() ? 2 : 1 : 0;
+        return enabled ? super.getState() : 0;
     }
 
     protected boolean getValue() {
@@ -23,4 +27,15 @@ public abstract class BoolButton extends AbstractButton {
     protected void setValue(boolean value) {
         this.value = value;
     }
+
+    @Override
+    protected void renderBackground(int mouseX, int mouseY) {
+        int left = this.x + 1;
+        int top = this.y + 1;
+        int right = left + this.width - 2;
+        int bottom = top + this.height - 2;
+        if (this.getValue()) {
+            drawRectangle(left, top, right, bottom, OVERLAY_COLOR);
+        }
+    }
 }
index 5c85899fe01cc0a6eaba3755f28b21d7f035d293..938d2f42be5d5673357ab9982de77918711d83bd 100644 (file)
@@ -14,6 +14,8 @@ public class BoundingBoxTypeButton extends BoolSettingButton {
 
     @Override
     protected void renderBackground(int mouseX, int mouseY) {
+        super.renderBackground(mouseX, mouseY);
+
         int left = x + 1;
         int top = y + 1;
         int right = left + width - 2;