How to disable/hide mouse pointer

Started by chriddel, June 09, 2004, 00:00:04

Previous topic - Next topic

chriddel

I am almost afraid to ask... but is there a way to disable or hide the mouse pointer in java/lwjgl? its always flickering so i would prefer it to disappear. or maybe its just very easy to make it stop flickering??

:oops:
sorry if thats a very stupid question, but i searched google for solution but didnt find anything but c++ code.

thanks,

chris

Matzon

QuotesetGrabbed

public static void setGrabbed(boolean grab)

   Sets whether or not the mouse has grabbed the cursor (and thus hidden).
on Mouse.

The flickering however, is odd - whats your OS and drivers?

chriddel

thank you matzon,

i use win xp and s3 twister - it might be the driver because i just owe a notebook with a "normal" graphic-card  :cry:  it also happens to the nehe tutorial examples in c++. but its strange because alienflux shows the mouse pointer without flickering.

btw: i cant find the public static void setGrabbed(boolean grab) in the 0.8 distribution. is it new in 0.9?

thanks + bye,

chris

Matzon

Quote from: "chriddel"i use win xp and s3 twister - it might be the driver because i just owe a notebook with a "normal" graphic-card  :cry:  it also happens to the nehe tutorial examples in c++. but its strange because alienflux shows the mouse pointer without flickering.
Hmm, might be something else than drivers then - just don't know where to start...
Quote from: "chriddel"
btw: i cant find the public static void setGrabbed(boolean grab) in the 0.8 distribution. is it new in 0.9?
Yup

Fool Running

If you are using 0.8 and don't want to change all of your code to 0.9, I think you can just call Mouse.create() and that will hide the mouse cursor.
(Just remember to call Mouse.destroy() afterwards.  :roll: )
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

chriddel

:D thanx! that worked great!
I just hope I won´t need the mouse pointer again  :shock:

Actually I am not stick with 0.8 but I had the feeling that its slightly faster than 0.9 (just a feeling - I didnt do any benchmarks)

chris

oNyx

>I just hope I won´t need the mouse pointer again

Hehe :)

Well, it sounds like a driver issue with hardware cursors. Btw AF's mouse cursor is/was done in software. So if you ever need a cursor and your driver is still broken you can just use a software cursor instead (just draw a quad with a cursor texture aligned to the mouse position - that's it).

chriddel

:D Thanx for the good hint!

No more headache with my mouse!  8)

Chris

n4pgamer

How can I hide the Cursor AND let it leave the Display window ? I'm using window mode and want to hide the cursor only when it is over the game window.

princec

That behaviour sounds entirely wrong.

Cas :)

n4pgamer

Quote from: princec on December 22, 2011, 16:21:15That behaviour sounds entirely wrong.

I can't believe I'm reading this ....
It is a very common behaviour in windowed games.
Not everything is in first-person-perspective.

CodeBunny

I can vouch. I've seen games do this before.

It's mainly for games that are windowed, so they don't want to lock the cursor; but they don't want to have the mouse cursor in the way of gameplay. Usually it's either a game that doesn't need the cursor at all, or it has a cursor it draws on its own.

I think a hackish way of doing this would be to simply set the cursor to a transparent image.

n4pgamer

Quote from: CodeBunny on December 23, 2011, 01:46:55I think a hackish way of doing this would be to simply set the cursor to a transparent image.
Sorry if I'm too lazy right now. But what functions do I use to do that ? That sounds good.

princec

Oh, I think I've just understood what you are trying to achieve - you want an invisible mouse, but you don't want to grab the mouse. Just set the mouse to a single invisible image:
emptyCursor = new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null);
Mouse.setNativeCursor(emptyCursor);


Cas :)

CodeBunny

That's an ugly way to do it, though. The most sensible thing to do would be to have some sort of call such as: Mouse.showNativeCursor(false).

Any chance this could get added to the API at some point? It seems like an easy enough change.