There’s a little-known CustomDraw element (you may or may not already be familiar with the fs9gps:map customdraw element) you can add to your XML gauge pretty easily. Someone asked me about fs9view:view recently, and since I was adding to my knowledge on the topic, I thought I’d share my knowledge on this blog.
To back up a moment, yes, FSX is out the door. Apparently you can even buy it early (before the October 17th US release date!) at Best Buy in some locations, so thats no secret. Now I can spend some time now on things like blogs and start looking forward to what we may or may not do in the future.
Back to fs9view.
If you look at the Spirit of St. Louis in FS9, you’ll see a periscope. If you open the door to the periscope, it allows you to see a view of the outside world through a “periscope”. No, we don’t actually simulate the mirrors that would be inside such a periscope. Rather, we create another 3D view window, just like the larger one that allows you to see “out the window” in your 2D cockpit. You can set the pitch, bank, zoom level, and 3-dimensional offset of this view.
To add this to your own gauge, you’ll want something like (or refer to spirit_periscope.xml):
<Gauge Name=”Auxview test”>
<Position X=”20″ Y=”23″/>
<CustomDraw Name=”fs9view:view” X=”84″ Y=”77″ Zoom=”1.0″ Pitch=”0″ Bank=”0″ Heading=”180″ OffsetUp=”0″ OffsetForward=”0″ OffsetRight=”0″>
Note that the angles are measured in degrees and the offsets are measured in meters. So the above XML snippet will give a view looking behind you (Heading=”180″). Perhaps it could be used for a rear-view mirror in a 2-D cockpit… although you’ll have to use FSX in order for the Pitch, Bank, and Heading to work, as these parameters do NOT work in FS9.
The biggest gotcha that I ran into was that you need a transparent panel background where you want the view window to appear. Otherwise, the panel background will cover the view window, since the panel background (or any elements on top of it) will by default be layered on top of the window. I find this to be quite non-intuitive. So consider yourself warned! Look at the panel background for the Spirit of St. Louis for an example – note that there is a section of pure black (RGB=0,0,0) where the periscope view appears.