aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-05 12:09:05 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-05 12:09:05 +0200
commitbbf60dfc2bf4c3e081f3a81681f96b6240a2848c (patch)
tree99e59bf6b340bc311274f9d20e779c8d49980577 /src
parent232cda5d0bab37e948c8ac31a437cf148d55832d (diff)
downloadOneConfig-bbf60dfc2bf4c3e081f3a81681f96b6240a2848c.tar.gz
OneConfig-bbf60dfc2bf4c3e081f3a81681f96b6240a2848c.tar.bz2
OneConfig-bbf60dfc2bf4c3e081f3a81681f96b6240a2848c.zip
finished mod card
Diffstat (limited to 'src')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Fonts.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java2
-rw-r--r--src/main/resources/assets/oneconfig/font/Minecraft-Bold.otfbin0 -> 11164 bytes
-rw-r--r--src/main/resources/assets/oneconfig/font/Minecraft-Regular.otf (renamed from src/main/resources/assets/oneconfig/font/Minecraft.otf)bin11016 -> 11016 bytes
5 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
index 863a72d..360d4c4 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
@@ -9,8 +9,11 @@ import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
+import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor;
+import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
+import cc.polyfrost.oneconfig.utils.color.ColorUtils;
import gg.essential.universal.wrappers.UPlayer;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.fml.common.ModMetadata;
@@ -41,6 +44,8 @@ public class ModCard extends BasicElement {
@Override
public void draw(long vg, int x, int y) {
super.update(x, y);
+ Scissor scissor = ScissorManager.scissor(vg, x, y, width, height);
+
isHoveredMain = InputUtils.isAreaHovered(x, y, width, 87);
boolean isHoveredSecondary = InputUtils.isAreaHovered(x, y + 87, width - 32, 32) && !disabled;
if (disabled) RenderManager.setAlpha(vg, 0.5f);
@@ -52,11 +57,11 @@ public class ModCard extends BasicElement {
RenderManager.drawSvg(vg, modData.modIcon, x + 98, y + 19, 48, 48);
else RenderManager.drawImage(vg, modData.modIcon, x + 98, y + 19, 48, 48);
} else {
- RenderManager.drawText(vg, modData.name, x + 122 - RenderManager.getTextWidth(vg, modData.name, 24, Fonts.MINECRAFT) / 2f, y + 44, OneConfigConfig.WHITE, 24, Fonts.MINECRAFT);
+ RenderManager.drawText(vg, modData.name, x + 122 - RenderManager.getTextWidth(vg, modData.name, 24, Fonts.MINECRAFT_BOLD) / 2f, y + 44, ColorUtils.setAlpha(OneConfigConfig.WHITE, (int) (colorFrame.getAlpha() * 255)), 24, Fonts.MINECRAFT_BOLD);
}
favoriteButton.draw(vg, x + 212, y + 87);
favorite = favoriteButton.isToggled();
- RenderManager.drawText(vg, modData.name, x + 12, y + 103, OneConfigConfig.WHITE, 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, modData.name, x + 12, y + 103, ColorUtils.setAlpha(OneConfigConfig.WHITE, (int) (colorToggle.getAlpha() * 255)), 14f, Fonts.MEDIUM);
if (favorite) favoriteButton.setLeftIcon(SVGs.HEART_FILL);
else favoriteButton.setLeftIcon(SVGs.HEART_OUTLINE);
@@ -70,6 +75,7 @@ public class ModCard extends BasicElement {
active = toggled;
colorToggle.setPalette(active ? ColorPalette.PRIMARY : ColorPalette.SECONDARY);
RenderManager.setAlpha(vg, 1f);
+ ScissorManager.resetScissor(vg, scissor);
}
public void onClick() {
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Fonts.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Fonts.java
index 03352a9..74d7828 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Fonts.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/font/Fonts.java
@@ -5,7 +5,8 @@ public enum Fonts {
SEMIBOLD(new Font("inter-semibold", "/assets/oneconfig/font/SemiBold.otf")),
MEDIUM(new Font("inter-medium", "/assets/oneconfig/font/Medium.otf")),
REGULAR(new Font("inter-regular", "/assets/oneconfig/font/Regular.otf")),
- MINECRAFT(new Font("mc-regular", "/assets/oneconfig/font/Minecraft.otf"));
+ MINECRAFT_REGULAR(new Font("mc-regular", "/assets/oneconfig/font/Minecraft-Regular.otf")),
+ MINECRAFT_BOLD(new Font("mc-bold", "/assets/oneconfig/font/Minecraft-Bold.otf"));
public final Font font;
Fonts(Font font) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
index e67d491..f632784 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
@@ -280,7 +280,7 @@ public class TestConfig extends Config {
public static String stringTest123 = "text";
public TestConfig() {
- super(new Mod("hacks", ModType.UTIL_QOL, new VigilanceMigrator("./config/testConfig.toml")), "hacksConfig.json");
+ super(new Mod("Test Mod", ModType.UTIL_QOL, new VigilanceMigrator("./config/testConfig.toml")), "hacksConfig.json");
addDependency("switchTest5", () -> switchTest4);
addDependency("Test page.testDescription", () -> false);
}
diff --git a/src/main/resources/assets/oneconfig/font/Minecraft-Bold.otf b/src/main/resources/assets/oneconfig/font/Minecraft-Bold.otf
new file mode 100644
index 0000000..87b124c
--- /dev/null
+++ b/src/main/resources/assets/oneconfig/font/Minecraft-Bold.otf
Binary files differ
diff --git a/src/main/resources/assets/oneconfig/font/Minecraft.otf b/src/main/resources/assets/oneconfig/font/Minecraft-Regular.otf
index 54f08ad..54f08ad 100644
--- a/src/main/resources/assets/oneconfig/font/Minecraft.otf
+++ b/src/main/resources/assets/oneconfig/font/Minecraft-Regular.otf
Binary files differ