Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / How to get mouse move directions?

Author
Message
deathAngel
22
Years of Service
User Offline
Joined: 11th Feb 2003
Location:
Posted: 16th Feb 2003 08:43
Hi is there any similar command to the visual basic 6 command "on mouse_move".

I mean is there any way to determine mouse movement and which direction it's moving(left, right, up or down).???
KuRi
22
Years of Service
User Offline
Joined: 8th Feb 2003
Location:
Posted: 16th Feb 2003 12:24
Of Course, you must save actual and past coordinates.

lastx# = mousex()
lasty# = mousey()
sync

do

actualx# = mousex()
actualy# = mousey()

if (actualx# > lastx#) then IS RIGHT DIRECTION
if (actualx# < lastx#) then IS LEFT DIRECTION
if (actualy# > lastxy) then IS UP DIRECTION
if (actualy# < lastxy) then IS DOWN DIRECTION
sync

lastx# = actual#
lasty# = actualy#
loop

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Feb 2003 12:49
You can use MOUSEMOVEX() and MOUSEMOVEY().

do
x=MOUSEMOVEX()
y=MOUSEMOVEY()
if y < 0 then `move up
if y > 0 then `move down
if x < 0 then `move left
if x > 0 then `move right
loop

Login to post a reply

Server time is: 2025-05-18 00:05:00
Your offset time is: 2025-05-18 00:05:00