make colourset names legible and change checkbutton colors

This commit is contained in:
Bella 2020-03-05 20:28:54 -05:00
parent 3dcece476e
commit a8b7e93a33
No known key found for this signature in database
GPG Key ID: 03B01AC937D1C89C
5 changed files with 44 additions and 47 deletions

View File

@ -49,8 +49,8 @@ public class KamiFrameUI<T extends Frame> extends AbstractComponentUI<Frame> {
glColor4f(.17f, .17f, .18f, .9f);
RenderHelper.drawFilledRectangle(0, 0, component.getWidth(), component.getHeight()); // Main window
glColor3f(toF(componentWindowOutline.getRed()), toF(componentWindowOutline.getGreen()), toF(componentWindowOutline.getBlue()));
glLineWidth(componentWindowOutlineWidth);
glColor3f(toF(windowOutline.getRed()), toF(windowOutline.getGreen()), toF(windowOutline.getBlue()));
glLineWidth(windowOutlineWidth);
RenderHelper.drawRectangle(0, 0, component.getWidth(), component.getHeight()); // Border / Outline
GL11.glColor3f(1, 1, 1);
@ -106,9 +106,9 @@ public class KamiFrameUI<T extends Frame> extends AbstractComponentUI<Frame> {
if (component.isPinnable()) {
if (component.isPinned())
glColor3f(toF(componentPinnedColour.getRed()), toF(componentPinnedColour.getGreen()), toF(componentPinnedColour.getBlue()));
glColor3f(toF(pinnedWindow.getRed()), toF(pinnedWindow.getGreen()), toF(pinnedWindow.getBlue()));
else
glColor3f(toF(componentUnpinnedColour), toF(componentUnpinnedColour), toF(componentUnpinnedColour));
glColor3f(toF(unpinnedWindow), toF(unpinnedWindow), toF(unpinnedWindow));
RenderHelper.drawCircle(7, 4, 2f);
glLineWidth(3f);
glBegin(GL_LINES);
@ -120,7 +120,7 @@ public class KamiFrameUI<T extends Frame> extends AbstractComponentUI<Frame> {
}
if (component.equals(xLineComponent)) {
glColor3f(toF(componentLineColour), toF(componentLineColour), toF(componentLineColour));
glColor3f(toF(lineWindow), toF(lineWindow), toF(lineWindow));
glLineWidth(1f);
glBegin(GL_LINES);
{

View File

@ -6,6 +6,7 @@ import me.zeroeightsix.kami.gui.rgui.component.use.CheckButton;
import me.zeroeightsix.kami.gui.rgui.render.AbstractComponentUI;
import me.zeroeightsix.kami.gui.rgui.render.font.FontRenderer;
import static me.zeroeightsix.kami.util.ColourConverter.settingsToInt;
import static me.zeroeightsix.kami.util.ColourConverter.toF;
import static me.zeroeightsix.kami.util.ColourSet.*;
import static org.lwjgl.opengl.GL11.*;
@ -17,18 +18,21 @@ public class RootCheckButtonUI<T extends CheckButton> extends AbstractComponentU
@Override
public void renderComponent(CheckButton component, FontRenderer ff) {
glColor4f(toF(checkButtonBackgroundColour.getRed()), toF(checkButtonBackgroundColour.getGreen()), toF(checkButtonBackgroundColour.getBlue()), component.getOpacity());
glColor4f(toF(bgColour.getRed()), toF(bgColour.getGreen()), toF(bgColour.getBlue()), component.getOpacity());
if (component.isToggled()) { // I don't know why the R in this one is separate, 086 wrote it that way
glColor3f(checkButtonBackgroundColourOther, toF(checkButtonBackgroundColour.getGreen()), toF(checkButtonBackgroundColour.getBlue()));
glColor3f(toF(bgColourOther), toF(bgColour.getGreen()), toF(bgColour.getBlue()));
}
if (component.isHovered() || component.isPressed()) {
glColor4f(toF(checkButtonBackgroundColourHover.getRed()), toF(checkButtonBackgroundColourHover.getGreen()), toF(checkButtonBackgroundColourHover.getBlue()), component.getOpacity());
glColor4f(toF(bgColourHover.getRed()), toF(bgColourHover.getGreen()), toF(bgColourHover.getBlue()), component.getOpacity());
}
String text = component.getName();
int c = component.isPressed() ? 0xaaaaaa : component.isToggled() ? 0xff3333 : 0xdddddd;
String text = component.getName(); // on toggle, toggled, hovered enabled
int c = component.isPressed() ?
settingsToInt(buttonPressed.getRed(), buttonPressed.getGreen(), buttonPressed.getBlue()) : component.isToggled() ?
settingsToInt(buttonIdleT.getRed(), buttonIdleT.getGreen(), buttonIdleT.getBlue()) :
settingsToInt(buttonHoveredT.getRed(), buttonHoveredT.getGreen(), buttonHoveredT.getBlue());
if (component.isHovered())
c = (c & 0x7f7f7f) << 1;
c = (c & settingsToInt(buttonHoveredN.getRed(), buttonHoveredN.getGreen(), buttonHoveredN.getBlue())) << 1;
glColor3f(1, 1, 1);
glEnable(GL_TEXTURE_2D);

View File

@ -20,18 +20,18 @@ public class RootColorizedCheckButtonUI extends RootCheckButtonUI<ColorizedCheck
RootSmallFontRenderer ff = new RootSmallFontRenderer();
public RootColorizedCheckButtonUI() { // why are these values all hardcoded screm aksdlksalkdlk
checkButtonBackgroundColour = new Color(toF(200), toF(checkButtonBackgroundColour.getGreen()), toF(checkButtonBackgroundColour.getBlue()));
checkButtonBackgroundColourHover = new Color(toF(255), toF(checkButtonBackgroundColourHover.getGreen()), toF(checkButtonBackgroundColourHover.getBlue()));
bgColour = new Color(toF(200), toF(bgColour.getGreen()), toF(bgColour.getBlue()));
bgColourHover = new Color(toF(255), toF(bgColourHover.getGreen()), toF(bgColourHover.getBlue()));
}
@Override
public void renderComponent(CheckButton component, FontRenderer aa) {
glColor4f(toF(checkButtonBackgroundColour.getRed()), toF(checkButtonBackgroundColour.getGreen()), toF(checkButtonBackgroundColour.getBlue()), component.getOpacity());
glColor4f(toF(bgColour.getRed()), toF(bgColour.getGreen()), toF(bgColour.getBlue()), component.getOpacity());
if (component.isHovered() || component.isPressed()) {
glColor4f(toF(checkButtonBackgroundColourHover.getRed()), toF(checkButtonBackgroundColourHover.getGreen()), toF(checkButtonBackgroundColourHover.getBlue()), component.getOpacity());
glColor4f(toF(bgColourHover.getRed()), toF(bgColourHover.getGreen()), toF(bgColourHover.getBlue()), component.getOpacity());
}
if (component.isToggled()) {
glColor3f(toF(checkButtonBackgroundColour.getRed()), toF(checkButtonBackgroundColour.getGreen()), toF(checkButtonBackgroundColour.getBlue()));
glColor3f(toF(bgColour.getRed()), toF(bgColour.getGreen()), toF(bgColour.getBlue()));
}
// RenderHelper.drawRoundedRectangle(0,0,component.getWidth(), component.getHeight(), 3f);
@ -43,8 +43,8 @@ public class RootColorizedCheckButtonUI extends RootCheckButtonUI<ColorizedCheck
}
glEnd();
Color idleColour = component.isToggled() ? checkButtonIdleColourToggle : checkButtonIdleColourNormal;
Color downColour = component.isToggled() ? checkButtonDownColourToggle : checkButtonDownColourNormal;
Color idleColour = component.isToggled() ? buttonIdleT : buttonIdleN;
Color downColour = component.isToggled() ? buttonHoveredT : buttonHoveredN;
glColor3f(1, 1, 1);
glEnable(GL_TEXTURE_2D);

View File

@ -2,13 +2,16 @@ package me.zeroeightsix.kami.util;
/**
* @author S-B99
* Updated by S-B99 on 04/03/20
*/
public class ColourConverter {
public static float toF(int i) {
return i / 255f;
}
public static float toF(int i) { return i / 255f; }
public static float toF(double d) {
return (float) (d / 255f);
}
public static float toF(double d) { return (float) (d / 255f); }
public static int settingsToInt(int r, int g, int b, int a) { return (r << 16) | (g << 8) | (b) | (a << 24); }
public static int settingsToInt(int r, int g, int b) { return (r << 16) | (g << 8) | (b); }
// settingsToInt(r.getValue(), g.getValue(), b.getValue(), aBlock.getValue()
}

View File

@ -11,34 +11,24 @@ import static me.zeroeightsix.kami.util.ColourConverter.toF;
*/
public class ColourSet {
/* Check Button colours */
public static Color checkButtonBackgroundColour = new Color(67, 54, 191); // normal colored
public static Color checkButtonBackgroundColourHover = new Color(67, 54, 191); // light colored
public static float checkButtonBackgroundColourOther = .9f;
public static Color bgColour = new Color(67, 54, 191); // normal colored
public static Color bgColourHover = new Color(67, 54, 191); // light colored
public static double bgColourOther = 229.5;
public static Color checkButtonIdleColourNormal = new Color(200, 200, 200); // lighter grey
public static Color checkButtonDownColourNormal = new Color(190, 190, 190); // light grey
public static Color buttonPressed = new Color(177, 52, 235);
public static Color checkButtonIdleColourToggle = new Color(165, 158, 232); // lighter colored
public static Color checkButtonDownColourToggle = checkButtonIdleColourToggle.brighter();
public static Color buttonIdleN = new Color(200, 200, 200); // lighter grey
public static Color buttonHoveredN = new Color(190, 190, 190); // light grey
/* Component colours */
public static Color componentMainWindow = new Color(.17f, .17f, .18f, .9f);
public static float[] componentMainWindowArray;
public static Color buttonIdleT = new Color(165, 158, 232); // lighter colored
public static Color buttonHoveredT = buttonIdleT.brighter();
// public static float[] getComponentMainWindowArray() {
// componentMainWindowArray[0] = .17f;
// componentMainWindowArray[1] = .17f;
// componentMainWindowArray[2] = .18f;
// componentMainWindowArray[3] = .9f;
// return componentMainWindowArray;
// }
public static Color windowOutline = new Color(116, 101, 247);
public static float windowOutlineWidth = 1.8f;
public static Color componentWindowOutline = new Color(116, 101, 247);
public static float componentWindowOutlineWidth = 1.5f;
public static Color componentPinnedColour = new Color(165, 41, 255);
public static double componentUnpinnedColour = 168.3;
public static double componentLineColour = 112.2;
public static Color pinnedWindow = new Color(116, 101, 247);
public static double unpinnedWindow = 168.3;
public static double lineWindow = 112.2;
public static Color sliderColour = new Color(155, 144, 255);