LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: tobiaspc on April 28, 2012, 19:31:07

Title: Setting mouse grabbed AND make the curser visible
Post by: tobiaspc on April 28, 2012, 19:31:07
Hello,

i´m currently making a game and i have a small problem:

the user is able to rotate the camera, but the mouse should both be visible and not be able to move(always in the middle of the screen, but with delta movement).

using "mouse.setGrabbed" i get the latter, but it gets invisible.

Any ideas?
Title: Re: Setting mouse grabbed AND make the curser visible
Post by: matheus23 on April 29, 2012, 10:55:57
Acctually you can use Mouse.warp(midx, midy); to position the mouse on your window.

But I think its totally useless to do that, because you will always see the mouse at about the point you set it to, that means, the mouse will always be in the middle. Why show the mouse then?
Title: Re: Setting mouse grabbed AND make the curser visible
Post by: CodeBunny on April 29, 2012, 13:15:59
Are you trying to use the mouse as a reticule for an FPS?

If you want it visible but not able to move, just make it invisible, and render your own graphic where you want the mouse to be.
Title: Re: Setting mouse grabbed AND make the curser visible
Post by: tobiaspc on April 29, 2012, 19:16:03
QuoteAre you trying to use the mouse as a reticule for an FPS?

No, the user can move the mouse over the screen, if it gets near the borders, the camera moves. if he presses the middle mouse button, the mouse should stay where it was and rotate the camera.

QuoteIf you want it visible but not able to move, just make it invisible, and render your own graphic where you want the mouse to be.

trying this!
Title: Re: Setting mouse grabbed AND make the curser visible
Post by: CodeBunny on April 30, 2012, 02:29:07
Ah. When you said "not be able to move" and "always in the middle of the screen" it sounded like you were talking about making the mouse immobile.

Regardless, I would achieve this by grabbing the mouse and then rendering your own cursor in-game like I said.
Title: Re: Setting mouse grabbed AND make the curser visible
Post by: matheus23 on April 30, 2012, 08:12:00
But remember to ungrab the mouse if anything goes wrong *laugh*  ;D
Title: Re: Setting mouse grabbed AND make the curser visible
Post by: tobiaspc on April 30, 2012, 14:19:11
QuoteBut remember to ungrab the mouse if anything goes wrong *laugh*  

Yeah had this prob often while debugging... :)

Now it works. Thanks everyone! Download my game here (http://tobias.hilbig-ffb.de).