Setting mouse grabbed AND make the curser visible

Started by tobiaspc, April 28, 2012, 19:31:07

Previous topic - Next topic

tobiaspc

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?

matheus23

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?
My github account and currently active project: https://github.com/matheus23/UniverseEngine

CodeBunny

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.

tobiaspc

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!

CodeBunny

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.

matheus23

But remember to ungrab the mouse if anything goes wrong *laugh*  ;D
My github account and currently active project: https://github.com/matheus23/UniverseEngine

tobiaspc

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.