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

FSXA No laughs - Elementary question

Messages
165
Country
southafrica
I have this gauge in a popup panel. It show Left Fuel tank gallons

The gauge work with a background bitmap and another one that that indicate the qty.

My problem is that The whole indicator (Blue section) move to the left as the fuel drops, but only the right side must move to the left. the left side must stay as is.
here is what I am talking about.
gauge.jpg



Here is my code.
Code:
<Gauge Name="Fuel left tank" Version="1.0">
<Image Name="Fuel.bmp" Bright="No" />
<Element>

	<Element>

		<Position X="20" Y="20"/>
		<Text X="80" Y="25" Adjust="Left" Length="32" Font="Arial" Color="black" Bright="No">
		        <String>%((A:FUEL TANK LEFT MAIN QUANTITY, gallons))%!4.1f!</String>
		</Text>
	</Element>

	<Element>
		<Position X="100" Y="105"/>
		<Image Name="fuelindicator.bmp">
			<Nonlinearity>
				<Item Value="26.5" X="0" Y="1"/>
				<Item Value="13.25"  X="100" Y="1"/>
				<Item Value="0"  X="200" Y="1"/>
			</Nonlinearity>
     		</Image>
		<Shift>
			<Value Minimum="0" Maximum="26.5">
				(A:FUEL TANK LEFT MAIN QUANTITY, gallons)
			</Value>
			<Delay PixelsPerSecond="200"/>
		</Shift>
	</Element>


</Element>

</Gauge>


QUESTION?
Is there a way to have this area filled without having to use bitmaps. I basically just need a visual gauge indicating what the fuel level is.

If not, how can I get the left side to show as if that always stay put. I dont know how masks work.

Any help/guidance/recommendations to do it in another way will be appreciated.


Edit
Or if someone has a similar gauge that they have, that work properly, that you dont mind sharing, so that I just can look at the gauge and how it is being done, it can be sent to bliksimpie at gmail dot com.
 
Last edited:
Ok I found this piece of code that seem that might help me where it will fill the rectangle.

Now I just need it to get to work sideways.

I tested this and it is working, but now it is going up and down, but I think I will get it sorted hopefully

Code:
	<Element>
		<Select>
			<Value>(A:Airspeed select indicated or true, knots) 134 min</Value>
		</Select>
	</Element>

	<Element>
		<Position X="100" Y="250"/>
		<Shift>
			<Value>134 (A:Airspeed select indicated or true, knots) d 0 == ? near - </Value>
			<Scale Y="1"/>
		</Shift>
		<Rectangle Width="5" Height="133" FillColor="%('0x00FF00' 'Red' (A:Airspeed select indicated or true, knots) 100 &gt;= ! ?)" Bright="Yes">
			<HeightCode>(A:Airspeed select indicated or true, knots) d 0 == ? near </HeightCode>
		</Rectangle>
	</Element>
 
Perhaps change Scale Y="1" to Scale X="1"?

Then there is "HeightCode"...perhaps "WidthCode" ?

I'm just guessing here :)

It has been eons since I created an xml 'bar' gauge and am
several thousand miles from my sim computer and notes.

Paul
 
Last edited:
Something like this...
Code:
<Element>
	<Position X="100" Y="250"/>
	<Shift>
		<Value>26.5 (A:FUEL TANK LEFT MAIN QUANTITY, gallons) d 0 == ? near - </Value>
		<Scale X="1"/>
	</Shift>
	<Rectangle Width="133" Height="5" FillColor="%('0x00FF00' 'Red' (A:Airspeed select indicated or true, knots) 100 &gt;= ! ?)" Bright="Yes">
		<WidthCode>(A:FUEL TANK LEFT MAIN QUANTITY, gallons) d 0 == ? near </WidthCode>
	</Rectangle>
</Element>

On the other hand, it would have been easier to simply create a Mask for the slider bitmap... :D
 
Last edited:
thank you both
the scale changed to X and the "WidthCode" did the trick.

Mr Bill
to be honest I have never used a "mask", so I have no idea. I will try and find a gauge with a mask and try and see how it is being done.

Thanks again
 
thank you both
the scale changed to X and the "WidthCode" did the trick.

Mr Bill
to be honest I have never used a "mask", so I have no idea. I will try and find a gauge with a mask and try and see how it is being done.

Thanks again

A "Mask" is nothing more complicated than a bitmap that's pure black (transparent) except where you want the slider to be seen (the window). That area is filled with "almost black" (RGB:1,1,1)... :D
 
Mr bill
Ok i copied the background bmp file (Fuel.BMP).
made everything black (0,0,0) except where I want the indicator to show. That now is black (1,1,1) an the file is called "fuel_mask.BMP"

The file "Fuelindicator.bmp" is the long blue section moving left to right or right to left to indicate the Fuel.

now in my code below. Where is this "mask" Bitmap to be added and how

Code:
<Gauge Name="Fuel left tank" Version="1.0">
<Image Name="Fuel.bmp" Bright="No" />
<Element>

	<Element>

		<Position X="20" Y="20"/>
		<Text X="80" Y="25" Adjust="Left" Length="32" Font="Arial" Color="black" Bright="No">
		        <String>%((A:FUEL TANK LEFT MAIN QUANTITY, gallons))%!4.1f!</String>
		</Text>
	</Element>

	<Element>
		<Position X="100" Y="105"/>
		<Image Name="fuelindicator.bmp">
			<Nonlinearity>
				<Item Value="26.5" X="0" Y="1"/>
				<Item Value="13.25"  X="100" Y="1"/>
				<Item Value="0"  X="200" Y="1"/>
			</Nonlinearity>
     		</Image>
		<Shift>
			<Value Minimum="0" Maximum="26.5">
				(A:FUEL TANK LEFT MAIN QUANTITY, gallons)
			</Value>
			<Delay PixelsPerSecond="200"/>
		</Shift>
	</Element>


</Element>

</Gauge>
 

Attachments

Last edited:
Try this. You may need to adjust the <Axis X="n" Y="n"> values:

Code:
  <Element>
    <Position X="0" Y="0"/>
    <MaskImage Name="fuel_mask.bmp">
      <Axis X="100" Y="105"/>
    </MaskImage>
    <Position X="100" Y="105"/>
    <Image Name="fuelindicator.bmp">
      <Nonlinearity>
        <Item Value="26.5" X="0" Y="1"/>
        <Item Value="13.25"  X="100" Y="1"/>
        <Item Value="0"  X="200" Y="1"/>
      </Nonlinearity>
    </Image>
    <Shift>
      <Value Minimum="0" Maximum="26.5">
        (A:FUEL TANK LEFT MAIN QUANTITY, gallons)
      </Value>
      <Delay PixelsPerSecond="200"/>
    </Shift>
  </Element>
 
Thank you kindly, but with the code as you propose, the blue strip do not show at all now.

I dont know what to change the axis to for the mask, so I will play around with various settings to try and find what will bring back the blue Strip
 
Ok this work

I created another bitmap the exact size of the blue strip, and made it black (1,1,1) and the changed the position and axis and this is the result I got, that now work.

At last I think I now know how it work.

thanks a stack again mr Bill. Without your guidance I would still be without a working gauge.

Regards
Jb
Code:
 <Element>
    <Position X="00" Y="105"/>
    <MaskImage Name="fuelindicator_mask.bmp">
      <Axis X="0" Y="0"/>
    </MaskImage>
    <Position X="100" Y="105"/>
    <Image Name="fuelindicator.bmp">
      <Nonlinearity>
        <Item Value="26.5" X="0" Y="1"/>
        <Item Value="13.25"  X="100" Y="1"/>
        <Item Value="0"  X="200" Y="1"/>
      </Nonlinearity>
    </Image>
    <Shift>
      <Value Minimum="0" Maximum="26.5">
        (A:FUEL TANK LEFT MAIN QUANTITY, gallons)
      </Value>
      <Delay PixelsPerSecond="200"/>
    </Shift>
  </Element>
 
Hi,
Actually you don't need to use a <Mask> here; a <Clip> tag is much simple and efficient:

Code:
<Element>
    <Position X="100" Y="105"/>
    <Image Name="fuelindicator.bmp">
      <Nonlinearity>
        <Item Value="26.5" X="0" Y="1"/>
        <Item Value="13.25"  X="100" Y="1"/>
        <Item Value="0"  X="200" Y="1"/>
      </Nonlinearity>
    </Image>
    <Shift>
      <Value Minimum="0" Maximum="26.5">
        (A:FUEL TANK LEFT MAIN QUANTITY, gallons)
      </Value>
      <Delay PixelsPerSecond="200"/>
    </Shift>
    <Clip Left="100"/>
</Element>

I seldom use <Mask> whenever a <Clip> tag can give the same result and save to add an extra bitmap image .

Tom
 
Tom

can we clone you ?

Ok, I am off trying it. geesh I learn something every day.

thanks again for all you guys here at fsdeveloper, who so willingly share your knowledge.

Now I can finally complete an intricate gauge that will use this.
 
In summary though you've learned three methods to achieve the same end result:

  1. vector rectangle (using <WidthCode> or HeightCode>)
  2. bitmap with mask
  3. bitmap with <Clip>
 
Back
Top