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.

MAKE_SLIDER problem

Featured Replies

Hi,I'm having some trouble with the MAKE_SLIDER macro. The image is showing up on the gauge and the x and y callbacks are being called, however the image is just staying in one position and not moving when I return different float values back from my callback routine. Does anyone have any ideas on what maybe happening. The relative lines of code are:SLIDER_UPDATE_CALLBACK ball_slider_xcb;SLIDER_UPDATE_CALLBACK ball_slider_ycb;MAKE_SLIDER(ball_slider,BMP_MED_BALL,&textline_list,0,IMAGE_USE_TRANSPARENCY,0,120,112,MODULE_VAR_NONE, ball_slider_xcb, 0.0, MODULE_VAR_NONE, ball_slider_ycb, 0.0)PELEMENT_HEADER bslider_List[] = { &ball_slider.header, NULL};FLOAT64 FSAPI ball_slider_xcb (PELEMENT_SLIDER pelement){ return 200.0;}FLOAT64 FSAPI ball_slider_ycb (PELEMENT_SLIDER pelement){ return 250.0;}Thanks.

MAKE_SLIDER(ball_slider,BMP_MED_BALL,&textline_list,0,IMAGE_USE_TRANSPARENCY,0,120,112,MODULE_VAR_NONE, ball_slider_xcb, 0.0,MODULE_VAR_NONE, ball_slider_ycb, 0.0)In the above macro definition, the 0.0 values that you have following each of ball_slider_xcb and ball_slider_ycb represent scale_x and scale_y. I suspect that you need non-zero values here.Doug

Great thanks that worked with a 1.0 scale value...thought I tried that already. Now it looks like the ball is being painted at the return value of the callback, however the image is not being moved but is just being repainted, so there is multiple images being painted to the back ground. I currently just have a random number generating the values, something like this:FLOAT64 FSAPI ball_slider_xcb (PELEMENT_SLIDER pelement){ r = rand(); r = (r/RAND_MAX); r = r * 250; return r;}FLOAT64 FSAPI ball_slider_ycb (PELEMENT_SLIDER pelement){ r = rand(); r = (r/RAND_MAX); r = r * 250; return r;}Any idea how I get my little ball to move around and not have multiple images being painted?Thanks,Thomas

Figured it out...for the record I needed IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY in my macro.Thomas

>Figured it out...for the record I needed IMAGE_USE_ERASE |>IMAGE_USE_TRANSPARENCY in my macro.You also don't need the function declarations: // Fwd declarations SLIDER_UPDATE_CALLBACK ball_slider_xcb; SLIDER_UPDATE_CALLBACK ball_slider_ycb;if you put the function definitions before (above) the macro like this:FLOAT64 FSAPI ball_slider_xcb (PELEMENT_SLIDER pelement){ return 200.0; //pelement->source_var.var_value.n;}FLOAT64 FSAPI ball_slider_ycb (PELEMENT_SLIDER pelement){ return 250.0; //pelement->source_var.var_value.n;}MAKE_SLIDER( ball_slider, // Element name BMP_MED_BALL, // BMP resource &textline_list, // Next element list NULL, // Ptr to FAILURE_RECORD IMAGE_USE_TRANSPARENCY, // Image flags 0, // ASI? Forgot this one 120,112, // Position on BG MODULE_VAR_NONE, ball_slider_xcb, 0.0, // Callbacks MODULE_VAR_NONE, ball_slider_ycb, 0.0)PELEMENT_HEADER bslider_List[] = { &ball_slider.header, NULL};Note the format above is easier to read, especially if you paste in a template with comments (roll yer own as desired).Note also the use of "NULL" vs. 0 for pointer vars. This is more "proper" as the variable is a pointer, and will help remind you of this fact. BTW, you will most likely have to have a FAILURE_RECORD for it to work in FS, but perhaps not.Good luck.

  • Author
  • Moderator

That is exactally the template I use myself... It is much clearer to read and comprehend.Also, you do not need a FAILURE_RECORD at all. I never use 'em myself... ;)As for the "ASI_FLAGS"...That's one of the strangest things I've ever seen. What a silly place to put something like this! I'm not aware of anyone who's ever actually used either of them... *:-*Aircraft Special InstrumentationThese flags specify how the element will react in a special instrument situation. Currently this is used only with autopilot. This member can have the following values: Flag----------------------------DescriptionASI_ALT_MANUALLY_TUNABLE Sets a global flag that causes Flight Simulator to recognize that autopilot altitude hold is manually tunable. If this flag isn't set, turning on altitude hold maintains the current altitude instead of the currently set altitude.ASI_HEADING_MANUALLY_TUNABLE Sets a global flag that causes Flight Simulator to recognize that autopilot heading hold is manually tunable. If this flag isn't set, turning on heading hold would maintain the current heading instead of the currently set heading.

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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.