The GdiplusAircraft sample illustrates how to create C++ gauges for a plane in Microsoft Flight Simulator using the GDI+ static library. It provides an alternative implementation to the gauges present in the GaugeAircraft sample, using the advanced functionality of GDI+. Please refer to the GaugeAircraft sample to know more about the compilation process, and refer to the SimpleAircraft sample for more details about the package creation.


You can expand the link below to see the file and folder structure of the files that have been added to the SimpleAircraft project for this sample:

File OverviewFile Overview

|---+ GdiplusAircraft
|   |---+ Sources
|       |---+ Code
|           |---- Attitude.cpp
|           |---- Compass.cpp
|           |---- Bitmap.cpp
|           |---- GdiPlusWasmModule.sln
|           |---- GdiPlusWasmModule.vcxproj
|           |---- GdiPlusWasmModule.vcxproj.filters
|---+ PackageSources
    |---+ Data
        |---+ images
        |   |---- FSLogo.png
        |---- entypo.ttf
        |---- LICENSE_OFL.txt
        |---- NotoEmoji-Regular.ttf
        |---- Roboto-Bold.ttf
        |---- Roboto-Light.ttf
        |---- Roboto-Regular.ttf


The GdiPlusWasmModule.sln solution will allow you to compile the code with Microsoft Visual Studio 2019 in order to create the GdiPlusWasmModule.wasm WebAssembly module which will then be loaded by the game. Once compiled, the module will automatically be copied into the following folder


In order for the aircraft to use the gauges defined in the module, they have to be declared in the panel.cfg file found in the same folder:

htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=GdiPlusWasmModule.wasm&wasm_gauge=Compass, 0,0,1024,768
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=GdiPlusWasmModule.wasm&wasm_gauge=Attitude, 0,0,1024,768
htmlgauge00=WasmInstrument/WasmInstrument.html?wasm_module=GdiPlusWasmModule.wasm&wasm_gauge=Bitmap, 0,0,1024,768


As can be seen above, the gauges are referenced using the following URI scheme:




Gauge Files

The following files are used for the gauges in this example:

  • Attitude.cpp: provides a re-implementation of GaugeAircraft Attitude gauge, using polygons.
  • Compass.cpp: provides a re-implementation of GaugeAircraft Compass gauge, using using Path clipping.
  • Bitmap.cpp: provides a sample of how to load, create and display images.



Loading And Building The Project

Building the GdiplusAircraft project is identical to building the SimpleAircraft one. However please note that if you make changes to the C++ code and recompile the GDI+ module, you will have to build your package again (using the Build Package button in the Edit Package window). This can be done while the plane is used within the game.