]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blobdiff - src/main/java/com/irtimaled/bbor/client/gui/BoolButton.java
Change button ON state highlighting to make it more obvious in 1.15+
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / gui / BoolButton.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);
+        }
+    }
 }