From 9e4ce2dd126259e1e83618b3c14c5bef7c47a534 Mon Sep 17 00:00:00 2001 From: Joshua Sigona Date: Tue, 9 Nov 2021 17:52:24 +0900 Subject: [PATCH] Have invisibleCursor available in a variable. --- src/sig/SigRenderer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sig/SigRenderer.java b/src/sig/SigRenderer.java index 2bc8f97..54f31d1 100644 --- a/src/sig/SigRenderer.java +++ b/src/sig/SigRenderer.java @@ -20,6 +20,7 @@ import java.awt.AWTException; import java.awt.BorderLayout; import java.awt.Robot; import java.awt.Point; +import java.awt.Cursor; public class SigRenderer implements KeyListener,MouseListener,MouseMotionListener{ @@ -78,6 +79,8 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene public static Panel panel; + public static Cursor invisibleCursor; + void addSpeed(Vector v) { vCameraSpeed.x=Math.min(MOVESPEED,Math.max(-MOVESPEED,v.x)); vCameraSpeed.y=Math.min(MOVESPEED,Math.max(-MOVESPEED,v.y)); @@ -272,7 +275,10 @@ public class SigRenderer implements KeyListener,MouseListener,MouseMotionListene f.setSize(SCREEN_WIDTH,SCREEN_HEIGHT); f.add(panel,BorderLayout.CENTER); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - f.setCursor(f.getToolkit().createCustomCursor(new BufferedImage(1,1,BufferedImage.TYPE_INT_ARGB),new Point(),null)); + + invisibleCursor = f.getToolkit().createCustomCursor(new BufferedImage(1,1,BufferedImage.TYPE_INT_ARGB),new Point(),null); + + panel.setCursor(invisibleCursor); f.setVisible(true); panel.init();