Sign in to follow this  
glassman2005

Conditional display of macro elements?

Recommended Posts

Is it possible, through logic in the gauge callback, to prevent layers after the drawing surface from getting painted?I had hoped that the following, placed in a condition in the gauge callback, would effectively end the "layer chain", but it didn't work: slipskid_movingimage_layer[0] = NULL;So is there any way to conditionally end the layer chain so that nothing else draws after the drawing surface?

Share this post


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

The DRAW_FLAGS field has two interesting flags, but I'm not sure what to do from there....IMAGE_HIDDEN - Do not show this image until the gauge code specifically calls for it. These change dynamically.IMAGE_HIDDEN_TREE - Do not show this image, and all the images in the resource tree above it, until the gauge code specifically calls for it.So how do you make the "gauge code specifically call for it"?

Share this post


Link to post
Share on other sites

>>Is it possible, through logic in the gauge callback, to>prevent layers after the drawing surface from getting>painted?>>I had hoped that the following, placed in a condition in the>gauge callback, would effectively end the "layer chain", but>it didn't work:> slipskid_movingimage_layer[0] = NULL;>>So is there any way to conditionally end the layer chain so>that nothing else draws after the drawing surface?Yes. Perhaps this example will help you figure it out. It requires the new functions defined in the fs9gauges.h file I sent... ;)BTW, when you have time, please drop me an email at n4gix@comcast.netNote that the condition of attitude_lights determines which of the particular elements are drawn, and which are hidden. You could easily construct a list of all elements you wish to conditionally "hide" (i.e., not draw!)...//Day - night lookup_var(&avlights); if (avlights.var_value.n != 0) attitude_lights_on = 1; else attitude_lights_on = 0; if (attitude_lights_on == 1) { SHOW_LISTELEMENT(pgauge->elements_list[0],1); SHOW_LISTELEMENT(pgauge->elements_list[0],2); SHOW_LISTELEMENT(pgauge->elements_list[0],3); HIDE_LISTELEMENT(pgauge->elements_list[0],4); HIDE_LISTELEMENT(pgauge->elements_list[0],5); HIDE_LISTELEMENT(pgauge->elements_list[0],6); } else { SHOW_LISTELEMENT(pgauge->elements_list[0],4); SHOW_LISTELEMENT(pgauge->elements_list[0],5); SHOW_LISTELEMENT(pgauge->elements_list[0],6); HIDE_LISTELEMENT(pgauge->elements_list[0],1); HIDE_LISTELEMENT(pgauge->elements_list[0],2); HIDE_LISTELEMENT(pgauge->elements_list[0],3); }BTW, you may also wish to check out these new macro functions (I believe that Arne Bartels added these)://////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// new functions to change image flags in a linked list //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////EXTERN_C PELEMENT_HEADER FSAPI get_listelement_pointer(PELEMENT_HEADER pelement,UINT32 pos_element);EXTERN_C void FSAPI add_imagedata_to_listelement(PELEMENT_HEADER pelement,UINT32 pos_element,FLAGS image_flags);EXTERN_C void FSAPI remove_imagedata_from_listelement(PELEMENT_HEADER pelement,UINT32 pos_element,FLAGS image_flags);

Share this post


Link to post
Share on other sites

>The DRAW_FLAGS field has two interesting flags, but I'm not>sure what to do from there....>>IMAGE_HIDDEN - Do not show this image until the gauge code>specifically calls for it. These change dynamically.>>IMAGE_HIDDEN_TREE - Do not show this image, and all the images>in the resource tree above it, until the gauge code>specifically calls for it.>>So how do you make the "gauge code specifically call for it"?See my previous reply to the first question. Look in the fs9gauges.h file and note that there are now two "commands" you can use:#define SHOW_IMAGE(element) (element->image_flags &= ~IMAGE_HIDDEN)#define HIDE_IMAGE(element) (element->image_flags |= IMAGE_HIDDEN)Normal usage would be in either a callback:if (condition == true) { SHOW_IMAGE ; } else { HIDE_IMAGE ; }-or-as in my prior example where you've simply listed the elements you wish to show/hide in an if statement within the PRE_UPDATE code.

Share this post


Link to post
Share on other sites

As always, you're a wealth of information! Seems to make perfect sense, I'll give it a try. I had seen those functions when digging through the newer header file.....just wasn't sure where to use them.

Share this post


Link to post
Share on other sites

>>As always, you're a wealth of information!Some might say I'm simply full of it! ;)Nah, I just read a LOT and remember most of it... ;)

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