variable storage

Blitz3D Forums/Blitz3D Beginners Area/variable storage

chwaga(Posted 2007) [#1]
How can I store the current X Y position of the mouse, in a seperate variable, but maintain the number for later, even after the mouse has been moved? I believe the "n = mousex,mousey" thing wouldn't work because it would change as the mouse moves. (i need this so i can have a system where you right click, and drag while holding RMB to orbit the camera (by the way, any help on a way to do that would help too:D) )

Thanks


Yo! Wazzup?(Posted 2007) [#2]
I don't think you would need this, but if you wanted to know where the mouse started, you would put n before the main loop.

EDIT:
Or:
While Not KeyDown(1)
If MouseHit(1)
x=Mousex()
y=Mousey()
EndIf
Text 1,1, x + "," + y
Cls
Wend 
End

This would make it so that when you press the first button on the mouse it would show.


Gabriel(Posted 2007) [#3]
You don't need to store the mouse position at all. If all you want to do is operate the camera when the mouse is held down and use the amount the mouse has moved to do that then simply use MouseXSpeed and MouseYSpeed.

If, for some reason, you did need to store the mouse position, then you would stop storing it when you don't need to. For example, store it when the RMB is held down this frame but was not held down in the last frame. Then retrieve the mouse from that variable when the RMB is not held down but was last frame.


Kev(Posted 2007) [#4]
set 2 sets of variable's, one for when the rmb is pressed and only update one set while the rmb is down.

somthing like this.

Global default_mx
Global default_my

Global rmb_mx
global rmb_my

if mousedown(2) then
 ;
 rmb_mx = MouseX()
 rmb_mx = MouseY()

else
 ; 
 default_mx = MouseX()
 default_my = MouseY()
 
endif


kev


chwaga(Posted 2007) [#5]
so if i were to translateentity the pivot (which the camera is attached to) and rotate the camera accordingly to the mouseX and Y speed number while RMB is held down?