Archived

This topic is now archived and is closed to further replies.

n4gix

What am I doing worng ?

Recommended Posts

I am trying to make a pitch indicator for an attitude indicator. Thats what I call it anyway, not sure if it is correct, just in case it is not called that and you lot do not know what I am talking about, working example the cessna attitude indicator click up and indicator goes up, click down and the indicator goes down. How's that for an explaination :-lol.Now for the relevant bits of code.SINT32 pitch_indicator_position = 0; FLOAT64 FSAPI pitch_position_cb( PELEMENT_MOVING_IMAGE pelement ){ return pitch_indicator_position;}MAKE_MOVING( pitch_indicator, PITCH_INDICATOR, bank_pointer_plist, attitude_fail, IMAGE_USE_TRANSPARENCY | IMAGE_USE_ERASE | BIT7, 0, 0,0, MODULE_VAR_NONE, NULL, 0, 0, MODULE_VAR_NONE, pitch_position_cb, 0, 5)PELEMENT_HEADER pitch_indicator_plist[] = {&pitch_indicator.header, NULL};BOOL FSAPI pitch_position_increase( PPIXPOINT relative_point, FLAGS32 mouse_flags ){ if (pitch_indicator_position != 5) pitch_indicator_position ++; return FALSE;}BOOL FSAPI pitch_position_decrease( PPIXPOINT relative_point, FLAGS32 mouse_flags ){ if (pitch_indicator_position != 0) pitch_indicator_position --; return FALSE;}MOUSE_CHILD_FUNCT( 89, 164, 36, 86, CURSOR_DOWNARROW, MOUSE_LEFTSINGLE, pitch_position_decrease)MOUSE_CHILD_FUNCT( 126, 164, 36, 86, CURSOR_UPARROW, MOUSE_LEFTSINGLE, pitch_position_increase)Everything shows up, but when you click for the indicator to go up, nothing happens. This is the first time I have done anything which needs more than two positions, really thought I had it worked out too :(

Share this post


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

Tried this with MAKE_NEEDLE and it works, So the problem must be with the callback for the MAKE_MOVING.Can anyone point me in the right direction, before I pull any more hair out ?

Share this post


Link to post
Share on other sites

Try using a SLIDER instead. It doesn't require a mask...Also, you haven't declared a float variable for the callback to use, so you aren't able to pass your control variable to it... ;)The following code works fine in my Electric Stby Attitude Indicator:FLOAT64 FSAPI EATD_AttBar( PELEMENT_SLIDER pelement){ FLOAT64 rwordY = pelement->source_var_y.var_value.n ; rwordY = attitude_electric_bar ; return rwordY ;}MAKE_SLIDER(EATD_Slider6,EATD_Rec8,&EATD_ElementList4,NULL, IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | BIT7,0,69,118, MODULE_VAR_NONE,NULL, MODULE_VAR_NONE,EATD_AttBar,-8)PELEMENT_HEADER EATD_ElementList5[] = { &EATD_Slider6.header, NULL};// Mouse CallbacksBOOL FSAPI EATD_mouse_cb0( PPIXPOINT relative_point, FLAGS32 mouse_flags){ if ( attitude_electric_bar > -3 ) { attitude_electric_bar = attitude_electric_bar - 0.25 ; } (GaugePlaySound)("soundESEPclick.wav","",0) ; return FALSE;}BOOL FSAPI EATD_mouse_cb1( PPIXPOINT relative_point, FLAGS32 mouse_flags){ if ( attitude_electric_bar < 3 ) { attitude_electric_bar = attitude_electric_bar + 0.25 ; } (GaugePlaySound)("soundESEPclick.wav","",0) ; return FALSE;}

Share this post


Link to post
Share on other sites

Slight problem with using a MAKE_SLIDER, I need a mask. I thought I had sorted it earlier, realised I had not made a dummy callback for the X direction, but that still does not work. I going to try MAKE_SPRITE later, see if I have better luck with that.

Share this post


Link to post
Share on other sites

>Slight problem with using a MAKE_SLIDER, I need a mask.Why do you need a mask?

Share this post


Link to post
Share on other sites

Need a mask to stop the stalk of the pitch indicator showing above the gauge bezel... wait a minute. Don't need a mask I could use a another bitmap with the bottom of the gauge bezel above the MAKE_SLIDER then the stalk would not show above the gauge bezel. It is official I am a fool :-) I will let you know how I get on.

Share this post


Link to post
Share on other sites

Sorted. Changed the MAKE_MOVING to MAKE_SLIDER, kept everything else the same and it works. Thanks for the help Bill.:-beerchug

Share this post


Link to post
Share on other sites

>Sorted. Changed the MAKE_MOVING to MAKE_SLIDER, kept>everything else the same and it works. >>Thanks for the help Bill.>>:-beerchugNo problem. Sometimes it helps to sort out the priorities of display......in fact, I frequently will not add the "bezel" (or anything that must "be on top") until until a final MAKE_STATIC element.BTW, just for the record, there is a default variable and associated key_events for this particular part... ;)ATTITUDE_BARS_POSITIONKEY_ATTITUDE_BARS_POSITION_INCKEY_ATTITUDE_BARS_POSITION_DECHowever, it's good to develop an alternative so that we can have independent control over the attitude calibration bars on multiple ADIs... ;)

Share this post


Link to post
Share on other sites