getting mouse/crosshair in the middle of the screen

Posted By: gameplan

getting mouse/crosshair in the middle of the screen - 10/05/12 20:03

Hi,

this is a very simple problem, but I dont know, why this code doesnt work. I am trying to get the crosshair in the middle of the screen, and I use mouse_mode = 1. This is my code:

mouse_pos.x = screen_size.x/2;
mouse_pos.x = screen_size.y/2;

But the mouse stays on top of the gamewindow, not even in the middle. What did I wrong?

EDIT:
What I need is the mousecursor to stay in the middle, so that I am able to click on entites. I think this should be easy, but somehow, there exists no such mouse_mode or something like this.

Thanks
Posted By: Superku

Re: getting mouse/crosshair in the middle of the screen - 10/05/12 20:05

Don't use the mouse, use a panel instead (if you are in fact trying to realize a crosshair).
If you are really trying to change the mouse position, I think you have to use the Windows function "SetCursorPos".
Posted By: gameplan

Re: getting mouse/crosshair in the middle of the screen - 10/05/12 20:10

A panel wont work, because I need to click with this pointer on entities.
EDIT:
How do I use SetCursorPos, it is not explained in the manual?
Posted By: Superku

Re: getting mouse/crosshair in the middle of the screen - 10/05/12 20:47

Why don't you just use c_trace instead?
Use the forum search for SetCursorPos.
Posted By: gameplan

Re: getting mouse/crosshair in the middle of the screen - 10/05/12 20:50

Ha, now it works. Thank you for your help. There was just a problem with "screen_size".
© 2024 lite-C Forums