diff options
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/renderer')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/renderer/scissor/Scissor.java | 4 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/renderer/scissor/ScissorManager.java | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/renderer/scissor/Scissor.java b/src/main/java/cc/polyfrost/oneconfig/renderer/scissor/Scissor.java index 179a260..62854ef 100644 --- a/src/main/java/cc/polyfrost/oneconfig/renderer/scissor/Scissor.java +++ b/src/main/java/cc/polyfrost/oneconfig/renderer/scissor/Scissor.java @@ -24,4 +24,8 @@ public class Scissor { this.width = scissor.width; this.height = scissor.height; } + + public boolean isInScissor(int x, int y) { + return x >= this.x && x <= this.x + this.width && y >= this.y && y <= this.y + this.height; + } } diff --git a/src/main/java/cc/polyfrost/oneconfig/renderer/scissor/ScissorManager.java b/src/main/java/cc/polyfrost/oneconfig/renderer/scissor/ScissorManager.java index 1f7801b..bfafedf 100644 --- a/src/main/java/cc/polyfrost/oneconfig/renderer/scissor/ScissorManager.java +++ b/src/main/java/cc/polyfrost/oneconfig/renderer/scissor/ScissorManager.java @@ -54,6 +54,11 @@ public class ScissorManager { private static void applyScissors(long vg) { NanoVG.nvgResetScissor(vg); if (scissors.size() <= 0) return; + Scissor finalScissor = getFinalScissor(scissors); + NanoVG.nvgScissor(vg, finalScissor.x, finalScissor.y, finalScissor.width, finalScissor.height); + } + + public static Scissor getFinalScissor(ArrayList<Scissor> scissors) { Scissor finalScissor = new Scissor(scissors.get(0)); for (int i = 1; i < scissors.size(); i++) { Scissor scissor = scissors.get(i); @@ -64,6 +69,6 @@ public class ScissorManager { finalScissor.width = rightX - finalScissor.x; finalScissor.height = rightY - finalScissor.y; } - NanoVG.nvgScissor(vg, finalScissor.x, finalScissor.y, finalScissor.width, finalScissor.height); + return finalScissor; } } |