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.

C++ Airspeed bug mouse function

Featured Replies

Hi all,C++ Airspeed Indicator and Airspeed Bug Mouse problem:The Airspeed Bug needle and mouse function is working, the problem is that I have not been able to limit the values controlled by the mouse, which despite all efforts still varies between 0 to 990 knots. Relevant code://-- (main .c file) -->MODULE_VAR airspeed_bug = {AUTOPILOT_AIRSPEED_HOLD_VAR};//-- (asi.c file -->MOUSE_FUNCTION asi_speed_up_set; //airspeed bug setMOUSE_FUNCTION asi_speed_down_set; //airspeed bug setMOUSE_BEGIN( asi_mouse_rect, 0, 0, 0 ) MOUSE_CHILD_FUNCT( 283, 24, 30, 30, CURSOR_UPARROW, MOUSE_LEFTSINGLE | MOUSE_DOWN_REPEAT, asi_speed_up ) MOUSE_CHILD_FUNCT( 250, 24, 30, 30, CURSOR_DOWNARROW, MOUSE_LEFTSINGLE | MOUSE_DOWN_REPEAT, asi_speed_down ) MOUSE_CHILD_FUNCT( 31, 24, 30, 30, CURSOR_HAND, MOUSE_LEFTSINGLE, asi_bug_set ) MOUSE_CHILD_FUNCT( 283, 260, 30, 40, CURSOR_UPARROW, MOUSE_LEFTSINGLE | MOUSE_DOWN_REPEAT, asi_speed_up_set ) MOUSE_CHILD_FUNCT( 247, 260, 30, 40, CURSOR_DOWNARROW, MOUSE_LEFTSINGLE | MOUSE_DOWN_REPEAT, asi_speed_down_set ) MOUSE_END// Maximum/minimum airspeed bug to be registered#define GAUGE_MAX_AIRSPEED_BUG 250#define GAUGE_MIN_AIRSPEED_BUG 60UINT32 airspeed = 0; //Reset airspeed bug set---// MOUSE Airspeed Bug UP SetBOOL FSAPI asi_speed_up_set( PPIXPOINT relative_point, FLAGS32 mouse_flags ){ lookup_var(&airspeed_bug); airspeed = (int)((double)airspeed_bug.var_value.n); if (airspeed < 60) airspeed = 60; trigger_key_event (KEY_AP_SPD_VAR_INC,1); return FALSE;}// MOUSE Airspeed Bug DOWN SetBOOL FSAPI asi_speed_down_set( PPIXPOINT relative_point, FLAGS32 mouse_flags ){ lookup_var(&airspeed_bug); airspeed = (int)((double)airspeed_bug.var_value.n); if (airspeed > 250) airspeed = 250; trigger_key_event (KEY_AP_SPD_VAR_DEC,1); return FALSE;}// Airspeed bug needle dayFLOAT64 FSAPI asi_speedbug_src_cb_day (PELEMENT_NEEDLE pelement){ lookup_var(&airspeed_bug); airspeed = (int)((double)airspeed_bug.var_value.n); if ( airspeed > GAUGE_MAX_AIRSPEED_BUG ) airspeed = GAUGE_MAX_AIRSPEED_BUG; if ( airspeed < GAUGE_MIN_AIRSPEED_BUG ) airspeed = GAUGE_MIN_AIRSPEED_BUG; if ( airspeed > 250 ) airspeed = 250; else if ( airspeed < 60 ) airspeed = 60; return airspeed;}//-- end -->The airspeed bug needle works fine, but mouse values is starting from 0 up to 990 knots as monitored by the FSlook program. Help on this one is appreciated!Best regardsJan H. Sorensenhttp://www.jspanels.com/images/logo_small.gifHomepage: http://www.jspanels.com

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.