diff options
author | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-05-24 20:11:53 +0100 |
---|---|---|
committer | nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> | 2022-05-24 20:11:53 +0100 |
commit | 5aa1f551386dc4bee411795a0dc029f15b2cbc0e (patch) | |
tree | 6da4f7ddc2e10a1c4c3d291bb2754ea4abba5ea2 /src/main/java/cc | |
parent | d69b634615134e294c4eee45827adc1eb73514b9 (diff) | |
download | OneConfig-5aa1f551386dc4bee411795a0dc029f15b2cbc0e.tar.gz OneConfig-5aa1f551386dc4bee411795a0dc029f15b2cbc0e.tar.bz2 OneConfig-5aa1f551386dc4bee411795a0dc029f15b2cbc0e.zip |
OC-5 Color selector things
Diffstat (limited to 'src/main/java/cc')
4 files changed, 14 insertions, 16 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java index 9a50a77..5714f11 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java @@ -22,7 +22,6 @@ public class OneConfigConfig extends Config { // the color library public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB(); // Transparent - public static final int TRANSPARENT_25 = new Color(0, 0, 0, 25).getRGB(); // Transparent 25% (used because of NanoVG culling) public static final int BLACK = new Color(0,0,0,255).getRGB(); // Black public static final int GRAY_900 = new Color(13, 14, 15, 255).getRGB(); // Gray 900 diff --git a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java index 0426090..3f6289e 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java @@ -187,7 +187,7 @@ public final class OneColor { * Return the color as if it had maximum saturation and brightness. Internal method. */ public int getRGBMax(boolean maxBrightness) { - return HSBAtoRGBA(hsba[0], maxBrightness ? hsba[1] : 100, 100, 255); + return HSBAtoRGBA(hsba[0], 100, maxBrightness ? 100 : hsba[2], 255); } /** diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java index a0c094a..2040364 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java @@ -105,11 +105,9 @@ public class ColorSelector { RenderManager.drawHollowRoundRect(vg, x - 3, y - 3, width + 4, height + 4, new Color(204, 204, 204, 77).getRGB(), 20f, 2f); RenderManager.drawRoundedRect(vg, x, y, width, height, OneConfigConfig.GRAY_800, 20f); RenderManager.drawString(vg, "Color Selector", x + 16, y + 32, OneConfigConfig.WHITE_90, 18f, Fonts.SEMIBOLD); - RenderManager.setAlpha(vg, 0.8f); - if (closeBtn.isHovered()) RenderManager.setAlpha(vg, 1f); - if (closeBtn.isClicked()) RenderManager.setAlpha(vg, 0.5f); + if(!closeBtn.isHovered()) RenderManager.setAlpha(vg, 0.8f); closeBtn.draw(vg, x + 368, y + 16); - RenderManager.drawSvg(vg, SVGs.X_CIRCLE, x + 368, y + 16, 32, 32); + RenderManager.drawSvg(vg, SVGs.X_CIRCLE, x + 368, y + 16, 32, 32, closeBtn.isHovered() ? OneConfigConfig.ERROR_600 : -1); RenderManager.setAlpha(vg, 1f); // hex parser @@ -209,7 +207,7 @@ public class ColorSelector { case 2: buttons.get(mode).currentColor = OneConfigConfig.TRANSPARENT; topSlider.setImage(Images.HUE_GRADIENT); - RenderManager.drawHSBBox(vg, x + 16, y + 120, 384, 288, color.getRGBMax(false)); + RenderManager.drawHSBBox(vg, x + 16, y + 120, 384, 288, color.getRGBMax(true)); if (dragging) { mouseX = InputUtils.mouseX(); mouseY = InputUtils.mouseY(); @@ -276,11 +274,12 @@ public class ColorSelector { if (dragging && InputUtils.isClicked(true)) { dragging = false; } - bottomSlider.setGradient(OneConfigConfig.TRANSPARENT_25, color.getRGBNoAlpha()); - RenderManager.drawImage(vg, Images.ALPHA_GRID, x + 16, y + 456, 384, 16); + bottomSlider.setGradient(OneConfigConfig.TRANSPARENT, color.getRGBNoAlpha()); + RenderManager.drawRoundImage(vg, Images.ALPHA_GRID, x + 16, y + 456, 384, 16, 8f); bottomSlider.draw(vg, x + 16, y + 456); - RenderManager.drawRoundedRect(vg, mouseX - 6, mouseY - 6, 12, 12, OneConfigConfig.WHITE, 12f); + RenderManager.drawRoundedRect(vg, mouseX - 7, mouseY - 7, 14, 14, OneConfigConfig.WHITE, 14f); + RenderManager.drawRoundedRect(vg, mouseX - 6, mouseY - 6, 12, 12, OneConfigConfig.BLACK, 12f); RenderManager.drawRoundedRect(vg, mouseX - 5, mouseY - 5, 10, 10, color.getRGBNoAlpha(), 10f); // deal with the input fields @@ -328,7 +327,7 @@ public class ColorSelector { // draw the color preview RenderManager.drawHollowRoundRect(vg, x + 15, y + 487, 384, 40, OneConfigConfig.GRAY_300, 12f, 2f); - RenderManager.drawImage(vg, Images.ALPHA_GRID, x + 20, y + 492, 376, 32); + RenderManager.drawRoundImage(vg, Images.ALPHA_GRID, x + 20, y + 492, 376, 32, 8f); RenderManager.drawRoundedRect(vg, x + 20, y + 492, 376, 32, color.getRGB(), 8f); InputUtils.blockClicks(true); if (closeBtn.isClicked()) { @@ -395,7 +394,7 @@ public class ColorSelector { RenderManager.drawHollowRoundRect(vg, currentDragPoint - 1, y - 1, 18, 18, OneConfigConfig.WHITE, 9f, 1f); RenderManager.drawHollowRoundRect(vg, currentDragPoint, y, 16, 16, OneConfigConfig.BLACK, 8f, 1f); if (color != null) { - RenderManager.drawRoundedRect(vg, currentDragPoint + 1.5f, y + 1.5f, 14, 14, color.getRGBNoAlpha(), 7f); + RenderManager.drawRoundedRect(vg, currentDragPoint + 1.5f, y + 1.5f, 14, 14, color.getRGBMax(true), 7f); } } diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java index a1c4d55..8a407e1 100644 --- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java +++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java @@ -91,8 +91,8 @@ public final class RenderManager { NVGPaint bg = NVGPaint.create(); nvgBeginPath(vg); nvgRoundedRect(vg, x, y, width, height, 8f); - NVGColor nvgColor = color(vg, OneConfigConfig.WHITE); // Do not use OneConfigConfig colors for this, use rgba code - MoonTidez - NVGColor nvgColor2 = color(vg, OneConfigConfig.TRANSPARENT_25); + NVGColor nvgColor = color(vg, -1); + NVGColor nvgColor2 = color(vg, OneConfigConfig.TRANSPARENT); nvgFillPaint(vg, nvgLinearGradient(vg, x, y, x + width, y, nvgColor, nvgColor2, bg)); nvgFill(vg); nvgColor.free(); @@ -101,8 +101,8 @@ public final class RenderManager { NVGPaint bg2 = NVGPaint.create(); nvgBeginPath(vg); nvgRoundedRect(vg, x, y, width, height, 8f); - NVGColor nvgColor3 = color(vg, OneConfigConfig.TRANSPARENT_25); - NVGColor nvgColor4 = color(vg, OneConfigConfig.BLACK); // Do not use OneConfigConfig colors for this, use rgba code - MoonTidez + NVGColor nvgColor3 = color(vg, OneConfigConfig.TRANSPARENT); + NVGColor nvgColor4 = color(vg, OneConfigConfig.BLACK); nvgFillPaint(vg, nvgLinearGradient(vg, x, y, x, y + height, nvgColor3, nvgColor4, bg2)); nvgFill(vg); nvgColor3.free(); |