Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get rid of the mouse cursor in full-screen exclusive mode?

I'm working on a simple 2D game engine in Java, and having no trouble with FSEM, buffer strategies, and so on; my issue is with the mouse cursor. In windowed mode, I can hide the mouse cursor, no problem, by using setCursor() from my JFrame to set a wholly-transparent cursor. However, after a call to device.setFullScreenWindow(this) to go into FSEM, the mouse cursor comes back, and subsequent calls to setCursor() to set it back to my blank cursor have no effect. Calling device.setFullScreenWindow(null) allows me to get rid of the cursor again - it's only while I'm in FSEM that I can't get rid of it.

I'm working under JDK 6, target platform is JDK 5+.

UPDATE: I've done some more testing, and it looks like this issue occurs under MacOS X 10.5 w/Java 6u7, but not under Windows XP SP3 with Java 6u7. So, it could possibly be a bug in the Mac version of the JVM.

like image 765
Adrian Avatar asked Oct 10 '08 14:10

Adrian


People also ask

How do I make my cursor go back to normal?

Step 1: In the Windows search box, search for "ease of access" and select Ease of access mouse settings from the resulting list. Step 2: In the left-side menu, select Mouse pointer. Step 3: Under Change pointer size, you can adjust the bar to a size that works best for you.

How do I get rid of the mouse on my custom cursor?

In the Pointers tab of the Mouse Properties pop up, select on the cursor you want to change under Customize and then click on "Browse" on the bottom-right hand corner of the screen. 2. You will now see a slew of cursor options for you to choose from. Select the cursor that you want and Click Open.

Why is my mouse cursor showing in game?

It could be that some games are launching in borderless window and are displayed "in the background". Just alt-tab out and in to the game to see whether the mouse cursos persists. Alt+enter, not alt tab. alt+enter, if it even has any function within a game, is usually for toggling between window and fullscreen mode.


2 Answers

Try Creating a custom invisible cursor:

    Toolkit toolkit = Toolkit.getDefaultToolkit();
    Point hotSpot = new Point(0,0);
    BufferedImage cursorImage = new BufferedImage(1, 1, BufferedImage.TRANSLUCENT); 
    Cursor invisibleCursor = toolkit.createCustomCursor(cursorImage, hotSpot, "InvisibleCursor");        
    setCursor(invisibleCursor);
like image 102
Janthoe Avatar answered Nov 15 '22 06:11

Janthoe


One developer found a way around it by creating a one pixel cursor out of a transparent GIF.

http://sevensoft.livejournal.com/23460.html

I know you tried that, but his is specifically addressing the issue of full-screen mode, exactly as you say, so perhaps there's something he's done that you haven't.

like image 43
davenpcj Avatar answered Nov 15 '22 06:11

davenpcj