aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/polyfrost/oneconfig/lwjgl
diff options
context:
space:
mode:
authornextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-04-23 13:51:31 +0100
committernextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com>2022-04-23 13:52:01 +0100
commita11a04cc1161a4ed55b85fa9bec877094f1e8e9d (patch)
tree423c49125b176dbabd72df562bd9b9e5f0397b02 /src/main/java/io/polyfrost/oneconfig/lwjgl
parent2b38d2d62391428a7fa40f268a4e65f876dd0e75 (diff)
downloadOneConfig-a11a04cc1161a4ed55b85fa9bec877094f1e8e9d.tar.gz
OneConfig-a11a04cc1161a4ed55b85fa9bec877094f1e8e9d.tar.bz2
OneConfig-a11a04cc1161a4ed55b85fa9bec877094f1e8e9d.zip
mod page, pages, and some more stuff
Diffstat (limited to 'src/main/java/io/polyfrost/oneconfig/lwjgl')
-rw-r--r--src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java18
-rw-r--r--src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java12
2 files changed, 17 insertions, 13 deletions
diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java
index e0a85c7..dcfd513 100644
--- a/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -192,9 +192,9 @@ public final class RenderManager {
NSVGPath path;
int i;
for (shape = image.shapes(); shape != null; shape.next()) {
- //if ((shape.flags() == NSVG_FLAGS_VISIBLE)) {
- // continue;
- //}
+ if ((shape.flags() == NSVG_FLAGS_VISIBLE)) {
+ continue;
+ }
nvgFillColor(vg, color(vg, shape.fill().color()));
nvgStrokeColor(vg, color(vg, shape.stroke().color()));
@@ -204,21 +204,15 @@ public final class RenderManager {
nvgBeginPath(vg);
FloatBuffer points = path.pts();
nvgMoveTo(vg, points.get(0), points.get(1));
- for (i = 0; i < path.npts() - 1; i += 3) {
- float[] p = new float[10];
- for (int j = 0; j < i * 2 + 3; j++) { // THIS WONT WORK WHy why why why
- p[j] = points.get(j);
- System.out.println(j + " " + p[j]);
- }
- nvgBezierTo(vg, p[2], p[3], p[4], p[5], p[6], p[7]);
+ for (i = 1; i < path.npts() - 1; i += 3) {
+ int b = i * 2;
+ nvgBezierTo(vg, points.get(b), points.get(b + 1), points.get(b + 2), points.get(b + 3), points.get(b + 4), points.get(b + 5));
}
if (path.closed() == 1) {
nvgLineTo(vg, points.get(0), points.get(1));
}
nvgStroke(vg);
}
-
-
}
} catch (Exception e) {
//e.printStackTrace();
diff --git a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
index 6fbd27f..4a35959 100644
--- a/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
+++ b/src/main/java/io/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
@@ -10,6 +10,7 @@ import org.lwjgl.stb.STBImage;
import org.lwjgl.system.MemoryStack;
import java.io.BufferedReader;
+import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
@@ -46,7 +47,16 @@ public class ImageLoader {
public boolean loadSVGImage(String fileName) {
if(!NSVGImageHashMap.containsKey(fileName)) {
try {
- CharSequence s = new BufferedReader(new InputStreamReader(Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("oneconfig", fileName)).getInputStream())).readLine();
+ InputStream inputStream = Minecraft.getMinecraft().getResourceManager().getResource(new ResourceLocation("oneconfig", fileName)).getInputStream();
+ StringBuilder resultStringBuilder = new StringBuilder();
+ try (BufferedReader br
+ = new BufferedReader(new InputStreamReader(inputStream))) {
+ String line;
+ while ((line = br.readLine()) != null) {
+ resultStringBuilder.append(line);
+ }
+ }
+ CharSequence s = resultStringBuilder.toString();
System.out.println(s);
NSVGImage image = NanoSVG.nsvgParse(s, "px", 96f);
NSVGImageHashMap.put(fileName, image);