aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/lwjgl
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-05 15:27:36 +0700
committerGitHub <noreply@github.com>2022-06-05 10:27:36 +0200
commit44dfbbb419f1736530c04c02a651f7757cf83f3d (patch)
tree1e8171573680b9415cecf199d479d49f7ad1f48a /src/main/java/cc/polyfrost/oneconfig/lwjgl
parent494d4f0bd0856e8e8d373003c82729ca722c6ccf (diff)
downloadOneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.tar.gz
OneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.tar.bz2
OneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.zip
rewrite command manager, stop using essential relocate, and reformat code (#34)
* reformat code * reformat code rewrite command manager stop using essential relocate
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/lwjgl')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java23
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java13
4 files changed, 27 insertions, 25 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
index d2b4811..1219782 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
@@ -5,10 +5,10 @@ import cc.polyfrost.oneconfig.events.event.RenderEvent;
import cc.polyfrost.oneconfig.events.event.ScreenOpenEvent;
import cc.polyfrost.oneconfig.events.event.Stage;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
-import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
import cc.polyfrost.oneconfig.mixin.ShaderGroupAccessor;
+import gg.essential.universal.UMinecraft;
+import gg.essential.universal.UScreen;
+import me.kbrewster.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.shader.Shader;
@@ -33,14 +33,12 @@ import java.util.List;
* https://github.com/boomboompower/ToggleChat/blob/master/LICENSE
*/
public class BlurHandler {
+ public static BlurHandler INSTANCE = new BlurHandler();
private final ResourceLocation blurShader = new ResourceLocation("shaders/post/fade_in_blur.json");
private final Logger logger = LogManager.getLogger("OneConfig - Blur");
-
private long start;
private float lastProgress = 0;
- public static BlurHandler INSTANCE = new BlurHandler();
-
/**
* Simply initializes the blur mod so events are properly handled by forge.
*/
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
index f366648..ef65ecf 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -3,9 +3,6 @@ package cc.polyfrost.oneconfig.lwjgl;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.config.data.InfoType;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import cc.polyfrost.oneconfig.libs.universal.UGraphics;
-import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
-import cc.polyfrost.oneconfig.libs.universal.UResolution;
import cc.polyfrost.oneconfig.lwjgl.font.Font;
import cc.polyfrost.oneconfig.lwjgl.font.FontManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
@@ -14,6 +11,9 @@ import cc.polyfrost.oneconfig.lwjgl.image.Images;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.NetworkUtils;
+import gg.essential.universal.UGraphics;
+import gg.essential.universal.UMinecraft;
+import gg.essential.universal.UResolution;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.shader.Framebuffer;
import org.lwjgl.nanovg.NVGColor;
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
index 289ab03..a0bb93c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
@@ -21,16 +21,18 @@ import java.util.HashMap;
* @see SVGs
*/
public final class ImageLoader {
+ public static ImageLoader INSTANCE = new ImageLoader();
+ private final HashMap<String, Integer> imageHashMap = new HashMap<>();
+ private final HashMap<String, Integer> svgHashMap = new HashMap<>();
+
private ImageLoader() {
}
- private final HashMap<String, Integer> imageHashMap = new HashMap<>();
- private final HashMap<String, Integer> svgHashMap = new HashMap<>();
- public static ImageLoader INSTANCE = new ImageLoader();
/**
* Loads an image from resources.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param fileName The name of the file to load.
* @return Whether the image was loaded successfully.
*/
@@ -58,10 +60,11 @@ public final class ImageLoader {
/**
* Loads an SVG from resources.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param fileName The name of the file to load.
- * @param width The width of the SVG.
- * @param height The height of the SVG.
+ * @param width The width of the SVG.
+ * @param height The height of the SVG.
* @return Whether the SVG was loaded successfully.
*/
public boolean loadSVG(long vg, String fileName, float width, float height) {
@@ -121,9 +124,8 @@ public final class ImageLoader {
* Remove an image from the cache, allowing the image to be garbage collected.
* Should be used when the GUI rendering the image is closed.
*
- * @param vg The NanoVG context.
+ * @param vg The NanoVG context.
* @param fileName The name of the file to remove.
- *
* @see ImageLoader#loadImage(long, String)
*/
public void removeImage(long vg, String fileName) {
@@ -162,9 +164,8 @@ public final class ImageLoader {
* Remove a SVG from the cache, allowing the SVG to be garbage collected.
* Should be used when the GUI rendering the SVG is closed.
*
- * @param vg The NanoVG context.
+ * @param vg The NanoVG context.
* @param fileName The name of the file to remove.
- *
* @see ImageLoader#loadSVG(long, String, float, float)
*/
public void removeSVG(long vg, String fileName, float width, float height) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
index 05747df..159de96 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
@@ -12,10 +12,11 @@ public class ScissorManager {
/**
* Adds and applies a scissor rectangle to the list of scissor rectangles.
- * @param vg The NanoVG context.
- * @param x The x coordinate of the scissor rectangle.
- * @param y The y coordinate of the scissor rectangle.
- * @param width The width of the scissor rectangle.
+ *
+ * @param vg The NanoVG context.
+ * @param x The x coordinate of the scissor rectangle.
+ * @param y The y coordinate of the scissor rectangle.
+ * @param width The width of the scissor rectangle.
* @param height The height of the scissor rectangle.
* @return The scissor rectangle.
*/
@@ -29,7 +30,8 @@ public class ScissorManager {
/**
* Resets the scissor rectangle provided.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param scissor The scissor rectangle to reset.
*/
public static void resetScissor(long vg, Scissor scissor) {
@@ -41,6 +43,7 @@ public class ScissorManager {
/**
* Clear all scissor rectangles.
+ *
* @param vg The NanoVG context.
*/
public static void clearScissors(long vg) {