Sign in to follow this  
n4gix

MAKE_SLIDER problem

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

>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.

Share this post


Link to post
Share on other sites

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.

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