LWJGL
May 19, 2013, 14:36:00 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL is now using GitHub
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Setting mouse grabbed AND make the curser visible  (Read 1029 times)
tobiaspc
Newbie
*
Posts: 5


« on: April 28, 2012, 12: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?
Logged
matheus23
Regular nerd
**
Posts: 62


« Reply #1 on: April 29, 2012, 03: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?
Logged

My github account and currently active project: https://github.com/matheus23/UniverseEngine
CodeBunny
Nerdus Imperius
*****
Posts: 561



WWW
« Reply #2 on: April 29, 2012, 06: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.
Logged
tobiaspc
Newbie
*
Posts: 5


« Reply #3 on: April 29, 2012, 12:16:03 »

Quote
Are 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.

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

trying this!
Logged
CodeBunny
Nerdus Imperius
*****
Posts: 561



WWW
« Reply #4 on: April 29, 2012, 19: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.
Logged
matheus23
Regular nerd
**
Posts: 62


« Reply #5 on: April 30, 2012, 01:12:00 »

But remember to ungrab the mouse if anything goes wrong *laugh*  Grin
Logged

My github account and currently active project: https://github.com/matheus23/UniverseEngine
tobiaspc
Newbie
*
Posts: 5


« Reply #6 on: April 30, 2012, 07:19:11 »

Quote
But remember to ungrab the mouse if anything goes wrong *laugh*  

Yeah had this prob often while debugging... Smiley

Now it works. Thanks everyone! Download my game here.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!