Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Grabbing a NEEDLE

Featured Replies

  • Commercial Member

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

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.

  • Author
  • Commercial Member

>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

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.