Jump to content

Recommended Posts

This is really a follow-on from my last post, Grabbing Mouse Co-ordinates. I'm still trying to get a hold of this ASI's speedbugs to rotate them via MOUSE_LEFTDRAG. I've got the actual maths in place to calculate the rotaional movement from the x and y co-ordinates and I know where the mouse cursor is on the instrument background. I can't find anything useful in the MAKE_NEEDLE pelement->struct to tell me where the needle is.... but I did find the rather odd fact that pelement->save_position.x (or y) divides the instrument face into quadrants of 64x64, regardless of any other measurement (bitmap, gauge size etc).Arne: if you're reading; you once gave me this code from an ATR-42 ASI but I've lost a complete CD full of all my FS2K/2K2 source code somewhere through the years and that was on it.... :(-Dai

Share this post


Link to post
Share on other sites
Guest bartels

I'll dig around. Are you sure you really need the actaul position? For speed bugs you can work without the actual position. Assume a speed bug as ELEMENT_NEEDLE showing a custom value. In the mouse function you can calculate angle and distance to the pivot point of the gauge, if angle and distance are near the speed bug you can "pick up and move" the speed bug by setting the angle from mouse position to the custom variable. In my ATR-42 ASI I decided to make that unnecessary complicated by using the actual speed as a variable not the angle on the gauge. So reverse lookup with nonlinearity tables was included. However I'll send the code as soon as I find it.

Share this post


Link to post
Share on other sites

>In the mouse function you can calculate angle and distance to the pivot point of the gauge, if angle and distance are near the speed bug you can "pick up and move" the>speed bug by setting the angle from mouse position to the custom variable.Yaargghhh!!!! I was so obsessed with grabbing within the boundary box of the speedbug that I totally overlooked the obvious. I've already written that code to calculate the rotational angle from the x and y pixels.... :-bang Thanks Arne!-Dai

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...