aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/lwjgl
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java44
-rw-r--r--src/main/java/io/polyfrost/oneconfig/lwjgl/font/FontManager.java2
2 files changed, 46 insertions, 0 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java
index dcfc348..d728670 100644
--- a/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -1,5 +1,6 @@
package io.polyfrost.oneconfig.lwjgl;
+import io.polyfrost.oneconfig.config.OneConfigConfig;
import io.polyfrost.oneconfig.lwjgl.font.Font;
import io.polyfrost.oneconfig.lwjgl.font.FontManager;
import io.polyfrost.oneconfig.lwjgl.image.Image;
@@ -63,6 +64,48 @@ public final class RenderManager {
GlStateManager.popAttrib();
}
+ public static void drawRectangle(long vg, float x, float y, float width, float height, int color) {
+ if(OneConfigConfig.ROUNDED_CORNERS) {
+ drawRoundedRect(vg, x, y, width, height, color, OneConfigConfig.CORNER_RADIUS);
+ } else {
+ drawRect(vg, x, y, width, height, color);
+ }
+ }
+
+ public static void drawGradientRectangle(long vg, float x, float y, float width, float height, int color1, int color2) {
+ if(OneConfigConfig.ROUNDED_CORNERS) {
+ drawGradientRoundedRect(vg, x, y, width, height, color1, color2, OneConfigConfig.CORNER_RADIUS);
+ } else {
+ drawGradientRect(vg, x, y, width, height, color1, color2);
+ }
+ }
+
+ public static void drawGradientRoundedRect(long vg, float x, float y, float width, float height, int color, int color2, float radius) {
+ NVGPaint bg = NVGPaint.create();
+ nvgBeginPath(vg);
+ nvgRoundedRect(vg, x, y, width, height, radius);
+ NVGColor nvgColor = color(vg, color);
+ NVGColor nvgColor2 = color(vg, color2);
+ nvgFillPaint(vg, nvgLinearGradient(vg, x, y + height, x + width, y, nvgColor, nvgColor2, bg)); // like the gradient is blocky
+ nvgFillPaint(vg, bg);
+ nvgFill(vg);
+ nvgColor.free();
+ nvgColor2.free();
+ }
+
+ public static void drawGradientRect(long vg, float x, float y, float width, float height, int color, int color2) {
+ NVGPaint bg = NVGPaint.create();
+ nvgBeginPath(vg);
+ nvgRect(vg, x, y, width, height);
+ NVGColor nvgColor = color(vg, color);
+ NVGColor nvgColor2 = color(vg, color2);
+ nvgFillPaint(vg, nvgLinearGradient(vg, x, y + height, x + width, y, nvgColor, nvgColor2, bg)); // like the gradient is blocky
+ nvgFillPaint(vg, bg);
+ nvgFill(vg);
+ nvgColor.free();
+ nvgColor2.free();
+ }
+
public static void drawRect(long vg, float x, float y, float width, float height, int color) {
nvgBeginPath(vg);
nvgRect(vg, x, y, width, height);
@@ -184,6 +227,7 @@ public final class RenderManager {
nvgColor.free();
}
+
public static NVGColor color(long vg, int color) {
NVGColor nvgColor = NVGColor.calloc();
nvgRGBA((byte) (color >> 16 & 0xFF), (byte) (color >> 8 & 0xFF), (byte) (color & 0xFF), (byte) (color >> 24 & 0xFF), nvgColor);
diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/font/FontManager.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/font/FontManager.java
index 20a8cc7..08d108b 100644
--- a/src/main/java/io/polyfrost/oneconfig/lwjgl/font/FontManager.java
+++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/font/FontManager.java
@@ -14,6 +14,8 @@ public class FontManager {
public void initialize(long vg) {
fonts.add(new Font("inter-bold", "/assets/oneconfig/font/Inter-Bold.ttf"));
+ fonts.add(new Font("inter-regular", "/assets/oneconfig/font/Inter-Regular.otf"));
+ fonts.add(new Font("inter-semibold", "/assets/oneconfig/font/Inter-SemiBold.otf"));
fonts.add(new Font("mc-regular", "/assets/oneconfig/font/Minecraft-Regular.otf"));
for (Font font : fonts) {
int loaded = -1;