• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

C++ plist question

mendiola_loyola

Resource contributor
Messages
520
Country
peru
Deal All:

One question, is there a problem if i reference the same plist three times in different sliders.

In this code i reference the plist adi_missing_vertical_icon_list three times in each MAKE_SLIDER.

Is that code correct?

Am i wrong?


Code:
MAKE_ICON
(		
	adi_missing_vertical_icon,
	BMP_ADI_MISSING_VER,
	NULL,
	NULL,
	IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | IMAGE_HIDDEN,
	0,
	53,95,
	MODULE_VAR_NONE, NULL,
	ICON_SWITCH_TYPE_SET_CUR_ICON,
	1,
	0,
	0
)

PELEMENT_HEADER		[B]adi_missing_vertical_icon_list[/B][] =
{
	&adi_missing_vertical_icon.header,
	NULL
};

//Slideres
MAKE_SLIDER //ILS
(
	cs_adi_slider_horizontal,
	BMP_ADI_VERT_MARK,
	[B]adi_missing_vertical_icon_list[/B],
	0,
	IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY,
	0,
	175,62,	
	//176,62,	
	VOR1_NEEDLE, NULL, 0.38, //Hace el papel del ILS
	MODULE_VAR_NONE, NULL, 0
)

MAKE_SLIDER //ILS Glide Slope
(
	cs_adi_slider_vertical,
	BMP_ADI_HORI_MARK,
	[B]adi_missing_vertical_icon_list[/B],
	0,
	IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY,
	0,
	//36,193,		
	36,194,		
	MODULE_VAR_NONE, NULL, 0,
	VOR1_GS_NEEDLE, NULL, 0.4 //Hace el papel del ILS
)

MAKE_SLIDER //Glide Slope
(
	cs_adi_slider_glide_slope,
	BMP_ADI_GLIDE_SLOPE,
	[B]adi_missing_vertical_icon_list[/B], 
	0,
	IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY,
	0,		
	125,193,		
	MODULE_VAR_NONE, NULL, 0,
	VOR1_GS_NEEDLE, NULL, 0.4 //Hace el papel del ILS
)

PELEMENT_HEADER		cs_adi_sliders_list[] =
{
	&cs_adi_slider_vertical.header,
	&cs_adi_slider_horizontal.header,
	&cs_adi_slider_glide_slope.header,
	NULL
};
Alfredo Mendiola Loyola
Lima, Perú
 
There are many ways to sequence the macros...

Frankly, I prefer the more straight forward approach where each macro calls the next one in sequence, like climbing a ladder.

Essentially, gauge bitmaps are assembled from the bottom up, so that's the order in which I structure the code.

The bottom element is ALWAYS a MAKE_STATIC macro. Note this example, especially the items highlighted in red:
Code:
MAKE_ICON(
		  MCP1_Icon2,
		  MCP1_Rec1,
		  [COLOR="Red"]&MCP1_ElementList10[/COLOR],  [COLOR="Green"][B]// pointer to next list item[/B][/COLOR]
		  NULL,IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | BIT7,0,0,0,
		  MODULE_VAR_NONE,
		  MCP1_callback2,ICON_SWITCH_TYPE_STEP_TO,2,0,0
		  )
PELEMENT_HEADER [COLOR="red"]MCP1_ElementList11[/COLOR][] = { // [COLOR="Green"][B]next list item[/B][/COLOR]
&MCP1_Icon2.header,
NULL
};

[B][COLOR="Green"]/// BASE IMAGE ///[/COLOR][/B]
MAKE_STATIC(
			MCP1_Static1,
			MCP1_Rec0,
			[COLOR="Red"]&MCP1_ElementList11[/COLOR], [COLOR="Green"][B]// pointer to next list item[/B][/COLOR]			NULL,IMAGE_USE_ERASE | IMAGE_USE_TRANSPARENCY | BIT7,0,0,0
			)
PELEMENT_HEADER B787_MCP_AP_Left_list = &MCP1_Static1.header;
So, once the first element has been "drawn," the pointer calls the next element in the list, which has the same NAME.

As I said, this is completely arbitrary, and you could just as easily replace them with "text" names as well. Frankly, I prefer to keep the numbers because it's easier to keep track of who-is-calling-who! :)
 
Some years ago I tried what Alfredo describes. I think it is a good idea to group the gauge elements as "layers", but I never could make it work. So I used the option proposed by Bill...

Eric
 
Back
Top