Jump to content
Sign in to follow this  
n4gix

What am I doing worng ?

Recommended Posts

Guest VAPilot

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
Guest VAPilot

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;}


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest VAPilot

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?


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest VAPilot

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
Guest VAPilot

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


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...