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.

Dark GDK / how do i reset dbMouseZ() ?

Author
Message
haliop
User Banned
Posted: 10th Jul 2012 15:59
i am using this method for mouse movement


the problem here is with mouse Z, mouse Z is used to zoom in and out in 3d Space , and i want it to reset each loop cause if i wont reset it it will continue to move on the Y axis up or down depending on dbMouseZ earlier action.

the dbMouseZ() will keep its action even if not touched after the loop cycle , so it will move in the last direction over and over again and i want it to move just once , cause the number is increasing or decreasing which makes the camera to Keep going up or down on the Y Axis.

can someone help ?

ty for your time.
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 10th Jul 2012 17:39
Well, either you store the last "Z-coordinate" and subtract it from the current one to get the difference, or you use dbMouseMoveZ() which does just that for you. Beware that it is automatically reset after each call though, so you might want to store its result if you're using it in more than one place.


"Why do programmers get Halloween and Christmas mixed up?"
haliop
User Banned
Posted: 11th Jul 2012 02:57
the problem with dbMouseMoveZ() is that it dosenot get a minus number
if i scroll it farward or backwards it gives me + something...

so i can only zoom in , i already tried it ..
Rudolpho
18
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 11th Jul 2012 03:10 Edited at: 11th Jul 2012 03:10
Oh, is that so?
I was not aware of that.
Anyway, the following should work (you might want to multiply it by a time factor to keep the scrolling speed steady across different frame rates):



"Why do programmers get Halloween and Christmas mixed up?"
prasoc
15
Years of Service
User Offline
Joined: 8th Oct 2008
Location:
Posted: 11th Jul 2012 03:12 Edited at: 11th Jul 2012 03:13
dbMouseMoveZ() *does* give a negative value if you scroll upwards (atleast on my mouse). You have to call it every frame to reset the value (otherwise it will sum the values up which you dont want). Essentially, dbMouseMoveZ() is "how far the scrollwheel has moved since the last call of dbMouseMoveZ()"


haliop
User Banned
Posted: 11th Jul 2012 12:08 Edited at: 11th Jul 2012 12:11
prasoc do you use DArkGDK 1.0 or 2.0 , cause i think that might be a bug in 2.0

and Rudolpho ty that works great.
Hawkblood
14
Years of Service
User Offline
Joined: 5th Dec 2009
Location:
Posted: 12th Jul 2012 16:28
I tried dbMouseMoveZ() today and it works both + & - directions. I'm using 2.0. Show the appropriate code--perhapse you are doing something wrong.....

The fastest code is the code never written.
haliop
User Banned
Posted: 12th Jul 2012 17:11
i am using rudolpho method so its all good ty.

Login to post a reply

Server time is: 2024-04-26 06:06:04
Your offset time is: 2024-04-26 06:06:04