LWJGL

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: How to disable/hide mouse pointer  (Read 16280 times)

chriddel

  • Newbie
  • *
  • Offline Offline
  • Posts: 27
How to disable/hide mouse pointer
« on: June 09, 2004, 00:00:04 »

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
Logged

Matzon

  • Administrator
  • Demigod
  • *****
  • Offline Offline
  • Posts: 2242
How to disable/hide mouse pointer
« Reply #1 on: June 09, 2004, 05:18:08 »

Quote
setGrabbed

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

  • Newbie
  • *
  • Offline Offline
  • Posts: 27
How to disable/hide mouse pointer
« Reply #2 on: June 09, 2004, 09:14:25 »

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
Logged

Matzon

  • Administrator
  • Demigod
  • *****
  • Offline Offline
  • Posts: 2242
How to disable/hide mouse pointer
« Reply #3 on: June 09, 2004, 09:50:10 »

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

  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 828
hmmmmmmmm
« Reply #4 on: June 09, 2004, 13:00:51 »

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: )
Logged
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

chriddel

  • Newbie
  • *
  • Offline Offline
  • Posts: 27
How to disable/hide mouse pointer
« Reply #5 on: June 09, 2004, 14:30:13 »

Logged

oNyx

  • Talks Too Much
  • ***
  • Offline Offline
  • Posts: 177
  • 弾幕
How to disable/hide mouse pointer
« Reply #6 on: June 18, 2004, 16:17:25 »

Logged

chriddel

  • Newbie
  • *
  • Offline Offline
  • Posts: 27
How to disable/hide mouse pointer
« Reply #7 on: June 22, 2004, 22:39:40 »

:D Thanx for the good hint!

No more headache with my mouse!  8)

Chris
Logged

n4pgamer

  • Newbie
  • *
  • Offline Offline
  • Posts: 9
Re: How to disable/hide mouse pointer
« Reply #8 on: December 22, 2011, 15:09:30 »

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.
Logged

princec

  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1878
Re: How to disable/hide mouse pointer
« Reply #9 on: December 22, 2011, 16:21:15 »

That behaviour sounds entirely wrong.

Cas :)

n4pgamer

  • Newbie
  • *
  • Offline Offline
  • Posts: 9
Re: How to disable/hide mouse pointer
« Reply #10 on: December 22, 2011, 19:10:36 »

That 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.
Logged

CodeBunny

  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 562
Re: How to disable/hide mouse pointer
« Reply #11 on: December 23, 2011, 01:46:55 »

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.
Logged

n4pgamer

  • Newbie
  • *
  • Offline Offline
  • Posts: 9
Re: How to disable/hide mouse pointer
« Reply #12 on: December 23, 2011, 06:22:56 »

I 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.
Logged

princec

  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 1878
Re: How to disable/hide mouse pointer
« Reply #13 on: December 23, 2011, 21:05:03 »

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:
Code: [Select]
emptyCursor = new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null);
Mouse.setNativeCursor(emptyCursor);


Cas :)

CodeBunny

  • Nerdus Imperius
  • *****
  • Offline Offline
  • Posts: 562
Re: How to disable/hide mouse pointer
« Reply #14 on: December 24, 2011, 15:55:50 »

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.
Logged
Pages: [1] 2