Thank you for replying.
I need to check the mouse position constantly even it's not moving, for example, if I move my mouse to (25, 50) and stop moving, when the mouseMoved() method detected that it's inside it will keep doing something until this mouse is moving away from this area. Someone suggests me to use a thread to check constantly inside the method, and use the listener to stop it anytime the mouseMoved() method changes the position. Now what I don't wanna use is thread, I am thinking if it is possible for me to do it C/C++ way like this:
Loop Check mouse position IF mouse position is in the area, do something ELSE do nothing End Loop
Since I am worring about the thread that will make our program unreliable or unstable, therefore I rarely use thread. The main reason is that since I am trying to make a very simple RTS game, so if mouse moving thread is stop responding or a bit slow because of the CPU time or whatever, it will make the game not synchronized. If I use C/C++ way that dose not use fork, check everything in one flow, it gurantees the flow.
Thus, do you have any idea that I can check the mouse position like the loop above without using thread? Since I tried having the mouseMoved() method loads another method that has a loop that checks the mouse position every iteration, but the mouseMoved() method cannot stop it even it changes the variable, I believe it's because of the loop takes highest priority.
Thank you very much, I appreciate your help.
Andy
Florin Herinean wrote:
I don't understand why do you want to check the mouse position if the mouse is not moving ??? It's obvious that the position is the last one where a mouse move event was fired. If you really need to know the mouse position at every moment, then just use the mouse move listener to store the position of the event in some convenient place. Then from wherever you are, you can get from there the current position. And don't forget to synchronize access to the mouse position.
Cheers,
Florin
-----Original Message----- From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED] Behalf Of Andy Sent: Dienstag, 27. April 2004 20:12 To: [EMAIL PROTECTED] Subject: [JAVA3D] Java3D and Mouse Listener question
Hi all,
I am currently have a program that has a cube, and a camera. I use mouse event listener to check if the mouse moves to the edge of the program, if yes, then it moves the camera. But if I move my mouse to the edge and stop there, it just checks whenever the mouse moves or not, otherwise, it doesn't know if the mouse pointer is on the edge or not. Then is there any class or method that I can use to check mouse pointer location every single second or loop? Thanks.
Andy
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
