Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting the mouse location



Hi,

I hope this question is not too elementary for this list, but I've thought
about this issue for quite a while and haven't been able to come up with a
solution on my own. And I'm sure somebody has run into this problem before.

I'm writing a 2D game in which an object's location is controlled by the
mouse. However, at some points in the game, the object moves independently
of the mouse for a period of time. When this period has elapsed, control of
the object returns to the mouse. The problem is, I want the mouse location
(or virtual location) to change along with the object when the object is
moving on its own accord. That way when the period has elapsed, the object
will not shoot to a new location (the new location of the mouse), because
the mouse will already be exactly where the object is.

I know there is a way to set the mouse location on OS 8/9, but I haven't
been able to find a way in OS X, and have doubts that it is even possible.

I have thought about using a 'virtual mouse location', updating this
location when the mouse moves (in response to deltas in the mouse location)
and setting it explicitly when the object moves by itself, but this method
fails when the mouse hits the side of the monitor. If the virtual mouse
location is still in the middle of the monitor then it can't move any
further in the direction of the mouse because the mouse can't go further
than the edge of the monitor.

Does anybody know how to set the mouse location in OS X, or have a different
solution to this problem?

Thanks in advance,
Dave
_______________________________________________
mac-games-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/mac-games-dev
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.