more changes to color and theme

This commit is contained in:
zelophed 2021-05-03 16:14:58 +02:00
parent f47feee20d
commit ae76821190
20 changed files with 155 additions and 137 deletions

View file

@ -10,7 +10,6 @@ import javax.annotation.Nonnull;
import org.apache.commons.lang3.StringUtils;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
@ -61,7 +60,7 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
@Override
protected void renderWindowBackground(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
RenderSystem.disableDepthTest();
//RenderSystem.disableDepthTest();
if (this.client != null && this.client.world != null) {
fill(ms, 0, 0, this.width, this.height, 0xb0_282c34);
} else {
@ -104,7 +103,9 @@ public abstract class ConfigScreen extends AbstractSimiScreen {
}
public static String toHumanReadable(String key) {
String s = Arrays.stream(StringUtils.splitByCharacterTypeCamelCase(key)).map(StringUtils::capitalize).collect(Collectors.joining(" "));
String s = key.replaceAll("_", " ");
s = Arrays.stream(StringUtils.splitByCharacterTypeCamelCase(s)).map(StringUtils::capitalize).collect(Collectors.joining(" "));
s = s.replaceAll("\\s\\s+", " ");
return s;
}

View file

@ -133,7 +133,7 @@ public class ConfigScreenList extends ExtendedList<ConfigScreenList.Entry> {
public LabeledEntry(String label) {
this.label = new TextStencilElement(Minecraft.getInstance().fontRenderer, label);
this.label.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.TEXT_ACCENT)));
this.label.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.TEXT_ACCENT_STRONG)));
labelTooltip = new ArrayList<>();
}

View file

@ -1,7 +1,5 @@
package com.simibubi.create.foundation.config.ui;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.util.text.StringTextComponent;
@ -17,20 +15,6 @@ public class ConfigTextField extends TextFieldWidget {
this.unit = unit;
}
@Override
public void renderButton(MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
super.renderButton(ms, mouseX, mouseY, partialTicks);
if (unit == null || unit.isEmpty())
return;
int unitWidth = font.getStringWidth(unit);
if (this.font.getStringWidth(getText()) > (getAdjustedWidth() - unitWidth))
return;
font.draw(ms, unit, x + getAdjustedWidth() - unitWidth, this.y + (this.height - 8) / 2, 0xcc_aaaaaa);
}
@Override
public void setFocused2(boolean focus) {
super.setFocused2(focus);

View file

@ -117,7 +117,6 @@ public class SubMenuConfigScreen extends ConfigScreen {
widgets.clear();
super.init();
//leave 40px on either side and dont be wider than 500px
listWidth = Math.min(width - 80, 300);
int yCenter = height / 2;
@ -255,7 +254,7 @@ public class SubMenuConfigScreen extends ConfigScreen {
stencil.withElementRenderer((ms, w, h, alpha) -> UIRenderHelper.angledGradient(ms, 90, 8, 0, 16, 16, green));
serverLocked.withBorderColors(green);
serverLocked.getToolTip().add(new StringTextComponent("Unlocked").formatted(TextFormatting.BOLD));
serverLocked.getToolTip().addAll(TooltipHelper.cutStringTextComponent("You have enough permissions to edit the server config. Changes you make here will be synced with the server once you saved them.", TextFormatting.GRAY, TextFormatting.GRAY));
serverLocked.getToolTip().addAll(TooltipHelper.cutStringTextComponent("You have enough permissions to edit the server config. Changes you make here will be synced with the server when you save them.", TextFormatting.GRAY, TextFormatting.GRAY));
}
widgets.add(serverLocked);

View file

@ -3,6 +3,7 @@ package com.simibubi.create.foundation.config.ui.entries;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.gui.RenderElement;
import com.simibubi.create.foundation.gui.Theme;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.gui.widgets.BoxWidget;
@ -26,14 +27,12 @@ public class BooleanEntry extends ValueEntry<Boolean> {
// .withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height/2, height, width, 0xff_f78888, 0xff_cc2020));
enabled = AllIcons.I_CONFIRM.asStencil()
.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2,
height, width, 0xff_88f788, 0xff_20cc20))
.<RenderElement>at(10, 0);
.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.BUTTON_SUCCESS)))
.at(10, 0);
disabled = AllIcons.I_DISABLE.asStencil()
.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2,
height, width, 0xff_f78888, 0xff_cc2020))
.<RenderElement>at(10, 0);
.withElementRenderer((ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.BUTTON_FAIL)))
.at(10, 0);
button = new BoxWidget().showingElement(enabled)
.withCallback(() -> setValue(!getValue()));

View file

@ -2,6 +2,7 @@ package com.simibubi.create.foundation.config.ui.entries;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.gui.AllIcons;
import com.simibubi.create.foundation.gui.BoxElement;
import com.simibubi.create.foundation.gui.DelegatedStencilElement;
import com.simibubi.create.foundation.gui.TextStencilElement;
import com.simibubi.create.foundation.gui.Theme;
@ -13,7 +14,7 @@ import net.minecraftforge.common.ForgeConfigSpec;
public class EnumEntry extends ValueEntry<Enum<?>> {
protected static final int cycleWidth = 34;// including 2px offset on either side
protected static final int cycleWidth = 34;
protected TextStencilElement valueText;
protected BoxWidget cycleLeft;
@ -85,13 +86,12 @@ public class EnumEntry extends ValueEntry<Enum<?>> {
cycleRight.y = y + 10;
cycleRight.render(ms, mouseX, mouseY, partialTicks);
BoxWidget boxWidget = new BoxWidget(0, 0, 10, 10);
boxWidget.x = cycleLeft.x + cycleWidth + 4;
boxWidget.y = cycleLeft.y + 3;
boxWidget.withBorderColors(java.awt.Color.black, java.awt.Color.black);
boxWidget.active = false;
boxWidget.render(ms, mouseX, mouseY, partialTicks);
new BoxElement()
.withBackground(0)
.flatBorder(0)
.withBounds(10, 10)
.at(cycleLeft.x + cycleWidth + 4, cycleLeft.y + 3)
.render(ms);
}
@Override

View file

@ -40,6 +40,7 @@ public abstract class NumberEntry<T extends Number> extends ValueEntry<T> {
super(label, value, spec);
textField = new ConfigTextField(Minecraft.getInstance().fontRenderer, 0, 0, 200, 20, unit);
textField.setText(String.valueOf(getValue()));
textField.setTextColor(Theme.i(Theme.Key.TEXT));
Object range = spec.getRange();
try {
@ -73,11 +74,11 @@ public abstract class NumberEntry<T extends Number> extends ValueEntry<T> {
if (!spec.test(number))
throw new IllegalArgumentException();
textField.setTextColor(0xff_20cc20);
textField.setTextColor(Theme.i(Theme.Key.TEXT));
setValue(number);
} catch (IllegalArgumentException ignored) {
textField.setTextColor(0xff_cc2020);
textField.setTextColor(Theme.i(Theme.Key.BUTTON_FAIL));
}
});

View file

@ -1,7 +1,10 @@
package com.simibubi.create.foundation.gui;
import java.awt.Color;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.Create;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.util.ResourceLocation;
@ -79,8 +82,8 @@ public enum AllGuiTextures implements IScreenRenderable {
INDICATOR_YELLOW("widgets.png", 54, 18, 18, 6),
INDICATOR_RED("widgets.png", 72, 18, 18, 6),
SPEECH_TOOLTIP("widgets.png", 0, 24, 8, 8),
SPEECH_TOOLTIP_HIGHLIGHT("widgets.png", 8, 24, 8, 8),
SPEECH_TOOLTIP_BACKGROUND("widgets.png", 0, 24, 8, 8),
SPEECH_TOOLTIP_COLOR("widgets.png", 8, 24, 8, 8),
// PlacementIndicator
PLACEMENT_INDICATOR_SHEET("placement_indicator.png", 0, 0, 16, 256);
@ -122,4 +125,9 @@ public enum AllGuiTextures implements IScreenRenderable {
bind();
screen.drawTexture(ms, x, y, startX, startY, width, height);
}
public void draw(MatrixStack ms, int x, int y, Color c) {
bind();
UIRenderHelper.drawColoredTexture(ms, c, x, y, startX, startY, width, height);
}
}

View file

@ -66,14 +66,21 @@ public class Theme {
put(Key.BUTTON_FAIL, new Color(0xcc_f78888, true), new Color(0xcc_cc2020, true));
put(Key.TEXT, new Color(0xff_eeeeee), new Color(0xff_a3a3a3));
put(Key.TEXT_DARKER, new Color(0xff_a3a3a3), new Color(0xff_808080));
put(Key.TEXT_ACCENT, new Color(0xff_7b7ba3), new Color(0xff_616192));
//values from PonderUI & PonderButton
put(Key.PONDER_BACKGROUND, new Color(0xdd_000000, true));
put(Key.TEXT_ACCENT_STRONG, new Color(0xff_7b7ba3), new Color(0xff_616192));
put(Key.TEXT_ACCENT_SLIGHT, new Color(0xff_ddeeff), new Color(0xff_a0b0c0));
put(Key.STREAK, new Color(0x101010, false));
put(Key.PONDER_BACKGROUND_TRANSPARENT, new Color(0xdd_000000, true));
put(Key.PONDER_BACKGROUND_FLAT, new Color(0xff_000000, false));
put(Key.PONDER_IDLE, new Color(0x40ffeedd, true), new Color(0x20ffeedd, true));
put(Key.PONDER_HOVER, new Color(0x70ffffff, true), new Color(0x30ffffff, true));
put(Key.PONDER_HIGHLIGHT, new Color(0xf0ffeedd, true), new Color(0x60ffeedd, true));
put(Key.TEXT_WINDOW_BORDER, new Color(0x607a6000, true), new Color(0x207a6000, true));
put(Key.PONDER_BACK_ARROW, new Color(0x70aa9999, true), new Color(0x30aa9999, true));
put(Key.PONDER_PROGRESSBAR, new Color(0x80ffeedd, true), new Color(0x50ffeedd, true));
put(Key.PONDER_MISSING_CREATE, new Color(0x70_984500, true), new Color(0x70_692400, true));
put(Key.PONDER_MISSING_VANILLA, new Color(0x50_5000ff, true), new Color(0x50_300077, true));
//put(Key., new Color(0x, true), new Color(0x, true));
}
protected void put(String key, Color c) {
@ -107,13 +114,21 @@ public class Theme {
public static Key TEXT = new Key();
public static Key TEXT_DARKER = new Key();
public static Key TEXT_ACCENT = new Key();
public static Key TEXT_ACCENT_STRONG = new Key();
public static Key TEXT_ACCENT_SLIGHT = new Key();
public static Key PONDER_BACKGROUND = new Key();
public static Key STREAK = new Key();
public static Key PONDER_BACKGROUND_TRANSPARENT = new Key();
public static Key PONDER_BACKGROUND_FLAT = new Key();
public static Key PONDER_IDLE = new Key();
public static Key PONDER_HOVER = new Key();
public static Key PONDER_HIGHLIGHT = new Key();
public static Key TEXT_WINDOW_BORDER = new Key();
public static Key PONDER_BACK_ARROW = new Key();
public static Key PONDER_PROGRESSBAR = new Key();
public static Key PONDER_MISSING_CREATE = new Key();
public static Key PONDER_MISSING_VANILLA = new Key();
private static int index = 0;

View file

@ -17,6 +17,7 @@ import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.shader.Framebuffer;
import net.minecraft.util.math.vector.Matrix4f;
@ -76,6 +77,8 @@ public class UIRenderHelper {
framebuffer.unbindFramebufferTexture();
}
public static void streak(MatrixStack ms, float angle, int x, int y, int breadth, int length) {streak(ms, angle, x, y, breadth, length, Theme.i(Theme.Key.STREAK));}
//angle in degrees; 0° -> fading to the right
//x and y specify the middle point of the starting edge
//breadth is the total width of the streak
@ -148,6 +151,8 @@ public class UIRenderHelper {
ms.pop();
}
public static void breadcrumbArrow(MatrixStack matrixStack, int x, int y, int z, int width, int height, int indent, Couple<Color> colors) {breadcrumbArrow(matrixStack, x, y, z, width, height, indent, colors.getFirst().getRGB(), colors.getSecond().getRGB());}
//draws a wide chevron-style breadcrumb arrow pointing left
public static void breadcrumbArrow(MatrixStack matrixStack, int x, int y, int z, int width, int height, int indent, int startColor, int endColor) {
matrixStack.push();
@ -231,4 +236,30 @@ public class UIRenderHelper {
RenderSystem.enableAlphaTest();
RenderSystem.enableTexture();
}
//just like AbstractGui#drawTexture, but with a color at every vertex
public static void drawColoredTexture(MatrixStack ms, Color c, int x, int y, int tex_left, int tex_top, int width, int height) {
drawColoredTexture(ms, c, x, y, 0, (float)tex_left, (float)tex_top, width, height, 256, 256);
}
public static void drawColoredTexture(MatrixStack ms, Color c, int x, int y, int z, float tex_left, float tex_top, int width, int height, int sheet_width, int sheet_height) {
drawColoredTexture(ms, c, x, x + width, y, y + height, z, width, height, tex_left, tex_top, sheet_width, sheet_height);
}
private static void drawColoredTexture(MatrixStack ms, Color c, int left, int right, int top, int bot, int z, int tex_width, int tex_height, float tex_left, float tex_top, int sheet_width, int sheet_height) {
drawTexturedQuad(ms.peek().getModel(), c, left, right, top, bot, z, (tex_left + 0.0F) / (float)sheet_width, (tex_left + (float)tex_width) / (float)sheet_width, (tex_top + 0.0F) / (float)sheet_height, (tex_top + (float)tex_height) / (float)sheet_height);
}
private static void drawTexturedQuad(Matrix4f m, Color c, int left, int right, int top, int bot, int z, float u1, float u2, float v1, float v2) {
RenderSystem.enableBlend();
BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR_TEXTURE);
bufferbuilder.vertex(m, (float)left , (float)bot, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u1, v2).endVertex();
bufferbuilder.vertex(m, (float)right, (float)bot, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u2, v2).endVertex();
bufferbuilder.vertex(m, (float)right, (float)top, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u2, v1).endVertex();
bufferbuilder.vertex(m, (float)left , (float)top, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).texture(u1, v1).endVertex();
bufferbuilder.finishDrawing();
RenderSystem.enableAlphaTest();
WorldVertexBufferUploader.draw(bufferbuilder);
}
}

View file

@ -119,7 +119,7 @@ public class BoxWidget extends ElementWidget {
return;
box.withAlpha(fadeValue);
box.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND))
box.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_TRANSPARENT))
.gradientBorder(gradientColor1, gradientColor2)
.at(x, y, z)
.withBounds(width, height)

View file

@ -115,10 +115,10 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen {
int maxX = backTrack.x + backTrack.getWidth();
if (x + 30 < backTrack.x)
UIRenderHelper.breadcrumbArrow(ms, x + 30, height - 51, 0, maxX - (x + 30), 20, 5, 0x70aa9999, 0x30aa9999);
UIRenderHelper.breadcrumbArrow(ms, x + 30, height - 51, 0, maxX - (x + 30), 20, 5, Theme.p(Theme.Key.PONDER_BACK_ARROW));
UIRenderHelper.breadcrumbArrow(ms, x, height - 51, 0, 30, 20, 5, 0x70aa9999, 0x30aa9999);
UIRenderHelper.breadcrumbArrow(ms, x - 30, height - 51, 0, 30, 20, 5, 0x70aa9999, 0x30aa9999);
UIRenderHelper.breadcrumbArrow(ms, x, height - 51, 0, 30, 20, 5, Theme.p(Theme.Key.PONDER_BACK_ARROW));
UIRenderHelper.breadcrumbArrow(ms, x - 30, height - 51, 0, 30, 20, 5, Theme.p(Theme.Key.PONDER_BACK_ARROW));
}
if (transition.getChaseTarget() == 0 || transition.settled()) {

View file

@ -8,8 +8,6 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.gui.BoxElement;
import com.simibubi.create.foundation.gui.Theme;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.animation.LerpedFloat;
import net.minecraft.client.Minecraft;
@ -20,7 +18,6 @@ import net.minecraftforge.fml.client.gui.GuiUtils;
public class PonderProgressBar extends AbstractSimiWidget {
LerpedFloat progress;
LerpedFloat flash;
PonderUI ponder;
@ -30,27 +27,12 @@ public class PonderProgressBar extends AbstractSimiWidget {
this.ponder = ponder;
progress = LerpedFloat.linear()
.startWithValue(0);
flash = LerpedFloat.linear()
.startWithValue(0);
}
public void tick() {
progress.chase(ponder.getActiveScene()
.getSceneProgress(), .5f, LerpedFloat.Chaser.EXP);
progress.tickChaser();
if (hovered)
flash();
}
public void flash() {
float value = flash.getValue();
flash.setValue(value + (1 - value) * .2f);
}
public void dim() {
float value = flash.getValue();
flash.setValue(value * .5f);
}
@Override
@ -111,58 +93,43 @@ public class PonderProgressBar extends AbstractSimiWidget {
hovered = clicked(mouseX, mouseY);
ms.push();
ms.translate(0, 0, 150);
/* ponderButtons are at z+400
* renderBox is at z+100
* gradients have to be in front of the box so z>+100
* */
new BoxElement()
.withBackground(0xff000000)
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
.at(x, y, 100)
.at(x, y, 250)
.withBounds(width, height)
.render(ms);
//ms.push();
//PonderUI.renderBox(ms, x, y, width, height, false);
//ms.pop();
ms.push();
ms.translate(x - 2, y - 2, 0);
ms.translate(x - 2, y - 2, 150);
ms.push();
ms.scale((width + 4) * progress.getValue(partialTicks), 1, 1);
GuiUtils.drawGradientRect(ms.peek().getModel(), 110, 0, 3, 1, 4, 0x80ffeedd, 0x80ffeedd);
GuiUtils.drawGradientRect(ms.peek().getModel(), 110, 0, 4, 1, 5, 0x50ffeedd, 0x50ffeedd);
int c1 = Theme.i(Theme.Key.PONDER_PROGRESSBAR, true);
int c2 = Theme.i(Theme.Key.PONDER_PROGRESSBAR, false);
GuiUtils.drawGradientRect(ms.peek().getModel(), 110, 0, 3, 1, 4, c1, c1);
GuiUtils.drawGradientRect(ms.peek().getModel(), 110, 0, 4, 1, 5, c2, c2);
ms.pop();
renderKeyframes(ms, mouseX, partialTicks);
ms.pop();
ms.pop();
}
private void renderKeyframes(MatrixStack ms, int mouseX, float partialTicks) {
PonderScene activeScene = ponder.getActiveScene();
int hoverStartColor;
int hoverEndColor;
int hoverStartColor = Theme.i(Theme.Key.PONDER_HOVER, true) | 0xa0_000000;
int hoverEndColor = Theme.i(Theme.Key.PONDER_HOVER, false) | 0xa0_000000;
int idleStartColor = Theme.i(Theme.Key.PONDER_IDLE, true) | 0x40_000000;
int idleEndColor = Theme.i(Theme.Key.PONDER_IDLE, false) | 0x40_000000;
int hoverIndex;
if (hovered) {
hoverIndex = getHoveredKeyframeIndex(activeScene, mouseX);
float flashValue = flash.getValue(partialTicks) * 3
+ (float) Math.sin((AnimationTickHolder.getTicks() + partialTicks) / 6);
hoverEndColor = ColorHelper.applyAlpha(0x70ffffff, flashValue);
hoverStartColor = ColorHelper.applyAlpha(0x30ffffff, flashValue);
} else {
hoverIndex = -2;
hoverEndColor = 0;
hoverStartColor = 0;
}
IntegerList keyframeTimes = activeScene.keyframeTimes;
@ -176,8 +143,8 @@ public class PonderProgressBar extends AbstractSimiWidget {
int keyframePos = (int) (((float) keyframeTime) / ((float) activeScene.totalTime) * (width + 4));
boolean selected = i == hoverIndex;
int startColor = selected ? hoverStartColor : 0x30ffeedd;
int endColor = selected ? hoverEndColor : 0x60ffeedd;
int startColor = selected ? hoverStartColor : idleStartColor;
int endColor = selected ? hoverEndColor : idleEndColor;
int height = selected ? 8 : 4;
drawKeyframe(ms, activeScene, selected, keyframeTime, keyframePos, startColor, endColor, height);

View file

@ -2,6 +2,7 @@ package com.simibubi.create.foundation.ponder;
import static com.simibubi.create.foundation.ponder.PonderLocalization.LANG_PREFIX;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -30,6 +31,7 @@ import com.simibubi.create.foundation.ponder.elements.TextWindowElement;
import com.simibubi.create.foundation.ponder.ui.PonderButton;
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.FontHelper;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Lang;
@ -536,13 +538,12 @@ public class PonderUI extends NavigatableSimiScreen {
float lazyIndexValue = lazyIndex.getValue(partialTicks);
float indexDiff = Math.abs(lazyIndexValue - index);
PonderScene activeScene = scenes.get(index);
int textColor = 0xeeeeee;
boolean noWidgetsHovered = true;
for (Widget widget : widgets)
noWidgetsHovered &= !widget.isMouseOver(mouseX, mouseY);
int tooltipColor = 0xffa3a3a3;
int tooltipColor = Theme.i(Theme.Key.TEXT_DARKER);
{
// Chapter title
ms.push();
@ -554,11 +555,11 @@ public class PonderUI extends NavigatableSimiScreen {
int wordWrappedHeight = textRenderer.getWordWrappedHeight(title, left.x - 51);
int streakHeight = 35 - 9 + wordWrappedHeight;
UIRenderHelper.streak(ms, 0, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (150 * fade), 0x101010);
UIRenderHelper.streak(ms, 180, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (30 * fade), 0x101010);
UIRenderHelper.streak(ms, 0, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (150 * fade));
UIRenderHelper.streak(ms, 180, x - 4, y - 12 + streakHeight / 2, streakHeight, (int) (30 * fade));
//renderBox(ms, 21, 21, 30, 30, false);
new BoxElement()
.withBackground(0xff000000)
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
.at(21, 21, 100)
.withBounds(30, 30)
@ -566,9 +567,9 @@ public class PonderUI extends NavigatableSimiScreen {
GuiGameElement.of(stack)
.<GuiGameElement.GuiRenderBuilder>at(x - 39, y - 11)
.scale(2)
.render(ms);
.scale(2)
.at(x - 39, y - 11)
.render(ms);
textRenderer.draw(ms, Lang.translate(PONDERING), x, y - 6, tooltipColor);
y += 8;
@ -578,18 +579,18 @@ public class PonderUI extends NavigatableSimiScreen {
ms.multiply(Vector3f.NEGATIVE_X.getDegreesQuaternion(indexDiff * -75));
ms.translate(0, 0, 5);
FontHelper.drawSplitString(ms, textRenderer, title, 0, 0, left.x - 51,
ColorHelper.applyAlpha(textColor, 1 - indexDiff));
ColorHelper.applyAlpha(Theme.i(Theme.Key.TEXT), 1 - indexDiff));
ms.pop();
if (chapter != null) {
ms.push();
ms.translate(chap.x - 4 - 4, chap.y, 0);
UIRenderHelper.streak(ms, 180, 4, 10, 26, (int) (150 * fade), 0x101010);
UIRenderHelper.streak(ms, 180, 4, 10, 26, (int) (150 * fade));
drawRightAlignedString(textRenderer, ms, Lang.translate(IN_CHAPTER).getString(), 0, 0, tooltipColor);
drawRightAlignedString(textRenderer, ms,
Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()).getString(), 0, 12, 0xffeeeeee);
Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()).getString(), 0, 12, Theme.i(Theme.Key.TEXT));
ms.pop();
}
@ -702,14 +703,14 @@ public class PonderUI extends NavigatableSimiScreen {
ms.translate(x, y + 5 * (1 - fade), 800);
float fadedWidth = 200 * chase.getValue(partialTicks);
UIRenderHelper.streak(ms, 0, 0, 12, 26, (int) fadedWidth, 0x101010);
UIRenderHelper.streak(ms, 0, 0, 12, 26, (int) fadedWidth);
GL11.glScissor((int) (x * s), 0, (int) (fadedWidth * s), (int) (height * s));
GL11.glEnable(GL11.GL_SCISSOR_TEST);
String tagName = this.tags.get(i)
.getTitle();
textRenderer.draw(ms, tagName, 3, 8, 0xffeedd);
textRenderer.draw(ms, tagName, 3, 8, Theme.i(Theme.Key.TEXT_ACCENT_SLIGHT));
GL11.glDisable(GL11.GL_SCISSOR_TEST);
@ -876,6 +877,8 @@ public class PonderUI extends NavigatableSimiScreen {
int divotSize = 8;
int distance = 1;
int divotRadius = divotSize / 2;
Couple<Color> borderColors = Theme.p(highlighted ? Theme.Key.PONDER_HIGHLIGHT : Theme.Key.PONDER_IDLE);
Color c;
switch (pointing) {
default:
@ -885,6 +888,7 @@ public class PonderUI extends NavigatableSimiScreen {
boxY -= h + divotSize + 1 + distance;
divotX -= divotRadius;
divotY -= divotSize + distance;
c = borderColors.getSecond();
break;
case LEFT:
divotRotation = 90;
@ -892,6 +896,7 @@ public class PonderUI extends NavigatableSimiScreen {
boxY -= h / 2;
divotX += distance;
divotY -= divotRadius;
c = ColorHelper.mixColors(borderColors, 0.5f);
break;
case RIGHT:
divotRotation = 270;
@ -899,6 +904,7 @@ public class PonderUI extends NavigatableSimiScreen {
boxY -= h / 2;
divotX -= divotSize + distance;
divotY -= divotRadius;
c = ColorHelper.mixColors(borderColors, 0.5f);
break;
case UP:
divotRotation = 180;
@ -906,23 +912,24 @@ public class PonderUI extends NavigatableSimiScreen {
boxY += divotSize + 1 + distance;
divotX -= divotRadius;
divotY += distance;
c = borderColors.getFirst();
break;
}
//renderBox(ms, boxX, boxY, w, h, highlighted);
new BoxElement()
.withBackground(0xff000000)
.gradientBorder(Theme.p(highlighted ? Theme.Key.PONDER_HIGHLIGHT : Theme.Key.PONDER_IDLE))
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
.gradientBorder(borderColors)
.at(boxX, boxY, 100)
.withBounds(w, h)
.render(ms);
ms.push();
AllGuiTextures toRender = highlighted ? AllGuiTextures.SPEECH_TOOLTIP_HIGHLIGHT : AllGuiTextures.SPEECH_TOOLTIP;
ms.translate(divotX + divotRadius, divotY + divotRadius, 10);
ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(divotRotation));
ms.translate(-divotRadius, -divotRadius, 0);
toRender.draw(ms, 0, 0);
AllGuiTextures.SPEECH_TOOLTIP_BACKGROUND.draw(ms, 0, 0);
AllGuiTextures.SPEECH_TOOLTIP_COLOR.draw(ms, 0, 0, c);
ms.pop();
if (returnWithLocalTransform) {

View file

@ -8,6 +8,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.crank.ValveHandleBlock;
import com.simibubi.create.foundation.gui.ScreenOpener;
import com.simibubi.create.foundation.gui.Theme;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.ponder.NavigatableSimiScreen;
import com.simibubi.create.foundation.ponder.PonderRegistry;
@ -156,8 +157,8 @@ public class PonderIndexScreen extends NavigatableSimiScreen {
ms.push();
ms.translate(x, y, 0);
UIRenderHelper.streak(ms, 0, chapterArea.getX() - 10, chapterArea.getY() - 20, 20, 220, 0x101010);
textRenderer.draw(ms, "Topics to Ponder about", chapterArea.getX() - 5, chapterArea.getY() - 25, 0xffddeeff);
UIRenderHelper.streak(ms, 0, chapterArea.getX() - 10, chapterArea.getY() - 20, 20, 220);
textRenderer.draw(ms, "Topics to Ponder about", chapterArea.getX() - 5, chapterArea.getY() - 25, Theme.i(Theme.Key.TEXT));
ms.pop();
}
@ -168,8 +169,8 @@ public class PonderIndexScreen extends NavigatableSimiScreen {
ms.push();
ms.translate(x, y, 0);
UIRenderHelper.streak(ms, 0, itemArea.getX() - 10, itemArea.getY() - 20, 20, 220, 0x101010);
textRenderer.draw(ms, "Items to inspect", itemArea.getX() - 5, itemArea.getY() - 25, 0xffddeeff);
UIRenderHelper.streak(ms, 0, itemArea.getX() - 10, itemArea.getY() - 20, 20, 220);
textRenderer.draw(ms, "Items to inspect", itemArea.getX() - 5, itemArea.getY() - 25, Theme.i(Theme.Key.TEXT));
ms.pop();
}

View file

@ -1,6 +1,5 @@
package com.simibubi.create.foundation.ponder.content;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -97,10 +96,10 @@ public class PonderTagScreen extends NavigatableSimiScreen {
if (i.getRegistryName()
.getNamespace()
.equals(Create.ID))
b.withBorderColors(new Color(0x70984500, true), new Color(0x70692400, true))
b.withBorderColors(Theme.p(Theme.Key.PONDER_MISSING_CREATE))
.animateColors(false);
else
b.withBorderColors(new Color(0x505000FF, true), new Color(0x50300077, true))
b.withBorderColors(Theme.p(Theme.Key.PONDER_MISSING_VANILLA))
.animateColors(false);
}
@ -124,10 +123,10 @@ public class PonderTagScreen extends NavigatableSimiScreen {
} else {
if (registryName.getNamespace()
.equals(Create.ID))
b.withBorderColors(new Color(0x70984500, true), new Color(0x70692400, true))
b.withBorderColors(Theme.p(Theme.Key.PONDER_MISSING_CREATE))
.animateColors(false);
else
b.withBorderColors(new Color(0x505000FF, true), new Color(0x50300077, true))
b.withBorderColors(Theme.p(Theme.Key.PONDER_MISSING_VANILLA))
.animateColors(false);
}
@ -193,21 +192,21 @@ public class PonderTagScreen extends NavigatableSimiScreen {
String title = tag.getTitle();
int streakHeight = 35;
UIRenderHelper.streak(ms, 0, x - 4, y - 12 + streakHeight / 2, streakHeight, 240, 0x101010);
UIRenderHelper.streak(ms, 0, x - 4, y - 12 + streakHeight / 2, streakHeight, 240);
//PonderUI.renderBox(ms, 21, 21, 30, 30, false);
new BoxElement()
.withBackground(0xff000000)
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
.at(21, 21, 100)
.withBounds(30, 30)
.render(ms);
textRenderer.draw(ms, Lang.translate(PonderUI.PONDERING), x, y - 6, 0xffa3a3a3);
textRenderer.draw(ms, Lang.translate(PonderUI.PONDERING), x, y - 6, Theme.i(Theme.Key.TEXT_DARKER));
y += 8;
x += 0;
ms.translate(x, y, 0);
ms.translate(0, 0, 5);
textRenderer.draw(ms, title, 0, 0, 0xeeeeee);
textRenderer.draw(ms, title, 0, 0, Theme.i(Theme.Key.TEXT));
ms.pop();
ms.push();
@ -228,14 +227,14 @@ public class PonderTagScreen extends NavigatableSimiScreen {
//PonderUI.renderBox(ms, x - 3, y - 3, w + 6, h + 6, false);
new BoxElement()
.withBackground(0xff000000)
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
.at(x - 3, y - 3, 90)
.withBounds(w + 6, h + 6)
.render(ms);
ms.translate(0, 0, 100);
FontHelper.drawSplitString(ms, textRenderer, desc, x, y, w, 0xeeeeee);
FontHelper.drawSplitString(ms, textRenderer, desc, x, y, w, Theme.i(Theme.Key.TEXT));
ms.pop();
}
@ -253,7 +252,7 @@ public class PonderTagScreen extends NavigatableSimiScreen {
ms.translate(x, y, 0);
//PonderUI.renderBox(ms, (sWidth - stringWidth) / 2 - 5, itemArea.getY() - 21, stringWidth + 10, 10, false);
new BoxElement()
.withBackground(0xff000000)
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
.gradientBorder(Theme.p(Theme.Key.PONDER_IDLE))
.at((sWidth - stringWidth) / 2f - 5, itemArea.getY() - 21, 100)
.withBounds(stringWidth + 10, 10)
@ -262,12 +261,12 @@ public class PonderTagScreen extends NavigatableSimiScreen {
ms.translate(0, 0, 200);
// UIRenderHelper.streak(0, itemArea.getX() - 10, itemArea.getY() - 20, 20, 180, 0x101010);
drawCenteredString(ms, textRenderer, relatedTitle, sWidth / 2, itemArea.getY() - 20, 0xeeeeee);
drawCenteredString(ms, textRenderer, relatedTitle, sWidth / 2, itemArea.getY() - 20, Theme.i(Theme.Key.TEXT));
ms.translate(0,0, -200);
UIRenderHelper.streak(ms, 0, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth() / 2 + 75, 0x101010);
UIRenderHelper.streak(ms, 180, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth() / 2 + 75, 0x101010);
UIRenderHelper.streak(ms, 0, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth() / 2 + 75);
UIRenderHelper.streak(ms, 180, 0, 0, itemArea.getHeight() + 10, itemArea.getWidth() / 2 + 75);
ms.pop();
@ -287,8 +286,8 @@ public class PonderTagScreen extends NavigatableSimiScreen {
ms.push();
ms.translate(chapterX, chapterY, 0);
UIRenderHelper.streak(ms, 0, chapterArea.getX() - 10, chapterArea.getY() - 20, 20, 220, 0x101010);
textRenderer.draw(ms, "More Topics to Ponder about", chapterArea.getX() - 5, chapterArea.getY() - 25, 0xffddeeff);
UIRenderHelper.streak(ms, 0, chapterArea.getX() - 10, chapterArea.getY() - 20, 20, 220);
textRenderer.draw(ms, "More Topics to Ponder about", chapterArea.getX() - 5, chapterArea.getY() - 25, Theme.i(Theme.Key.TEXT_ACCENT_SLIGHT));
ms.pop();
}

View file

@ -113,7 +113,7 @@ public class TextWindowElement extends AnimatedOverlayElement {
ms.translate(0, sceneToScreen.y, 400);
new BoxElement()
.withBackground(0xaa000000)
.withBackground(Theme.c(Theme.Key.PONDER_BACKGROUND_FLAT))
.gradientBorder(Theme.p(Theme.Key.TEXT_WINDOW_BORDER))
.at(targetX - 10, 3, 100)
.withBounds(boxWidth, boxHeight - 1)

View file

@ -5,6 +5,7 @@ import java.util.function.BiConsumer;
import javax.annotation.Nonnull;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.foundation.gui.Theme;
import com.simibubi.create.foundation.gui.UIRenderHelper;
import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget;
import com.simibubi.create.foundation.ponder.content.PonderChapter;
@ -30,9 +31,9 @@ public class ChapterLabel extends AbstractSimiWidget {
@Override
public void render(@Nonnull MatrixStack ms, int mouseX, int mouseY, float partialTicks) {
UIRenderHelper.streak(ms, 0, x, y + height / 2, height - 2, width, 0x101010);
UIRenderHelper.streak(ms, 0, x, y + height / 2, height - 2, width);
Minecraft.getInstance().fontRenderer.draw(ms, Lang.translate("ponder.chapter." + chapter.getId()), x + 50,
y + 20, 0xffddeeff);
y + 20, Theme.i(Theme.Key.TEXT_ACCENT_SLIGHT));
button.renderButton(ms, mouseX, mouseY, partialTicks);
super.render(ms, mouseX, mouseY, partialTicks);

View file

@ -71,6 +71,11 @@ public class ColorHelper {
);
}
@Nonnull
public static Color mixColors(@Nonnull Couple<Color> colors, float w) {
return mixColors(colors.getFirst(), colors.getSecond(), w);
}
public static int mixAlphaColors(int color1, int color2, float w) {
int a1 = (color1 >> 24);
int r1 = (color1 >> 16) & 0xFF;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB