Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » [SOLVED] al_set_mouse_xy woes

This thread is locked; no one can reply to it. rss feed Print
[SOLVED] al_set_mouse_xy woes
badvassal
Member #17,109
August 2019

Sorry for making a new thread. I wasn't able to reply to my previous post (https://www.allegro.cc/forums/thread/617952) for some reason. I think I solved the problem and I don't want others to waste time writing a response.

The solution is to just not call al_set_mouse_xy() at all. Just process the "relative movement" fields in mouse axes events (`dx` and dy) and adjust the crosshair location accordingly. I have no idea why I didn't try that sooner, but there it is!

EDIT: There is one more element to the solution that I was missing. I do actually have to call al_set_mouse_xy() occasionally. This is done to keep the (invisible) mouse cursor within a rectangle in the center of the screen. The technique is described in this thread: https://www.gamedev.net/forums/topic/546290-implememnting-fps-style-mouse-controls/

MikiZX
Member #17,092
June 2019

Good to hear you managed to find a solution.
As for replying, it is not possible by design though you can always edit your posts.

Go to: