]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blob - src/main/java/com/irtimaled/bbor/client/gui/BoundingBoxTypeButton.java
Setup for 1.16.3 Fabric
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / gui / BoundingBoxTypeButton.java
1 package com.irtimaled.bbor.client.gui;
2
3 import com.irtimaled.bbor.client.config.BoundingBoxTypeHelper;
4 import com.irtimaled.bbor.common.BoundingBoxType;
5 import net.minecraft.client.util.math.MatrixStack;
6
7 import java.awt.*;
8
9 public class BoundingBoxTypeButton extends BoolSettingButton {
10     private final BoundingBoxType type;
11
12     BoundingBoxTypeButton(int width, String label, BoundingBoxType type) {
13         super(width, label, BoundingBoxTypeHelper.renderSetting(type));
14         this.type = type;
15     }
16
17     @Override
18     protected void renderBackground(MatrixStack matrixStack, int mouseX, int mouseY) {
19         super.renderBackground(matrixStack, mouseX, mouseY);
20
21         int left = x + 1;
22         int top = y + 1;
23         int right = left + width - 2;
24         int bottom = top + height - 2;
25
26         Color color = BoundingBoxTypeHelper.getColor(type);
27
28         // top & left
29         drawRectangle(matrixStack, left, top, right, top + 1, color);
30         drawRectangle(matrixStack, left, top, left + 1, bottom, color);
31
32         Color darker = color.darker();
33         // bottom left & top right
34         drawRectangle(matrixStack, left, bottom - 2, left + 1, bottom, darker);
35         drawRectangle(matrixStack, right - 1, top, right, top + 1, darker);
36
37         Color darkest = darker.darker();
38         // bottom & right
39         drawRectangle(matrixStack, left + 1, bottom - 2, right, bottom, darkest);
40         drawRectangle(matrixStack, right - 1, top + 1, right, bottom, darkest);
41     }
42 }