The Microsoft Flight Simulator Nano VG API (also known as the low level API) exposes 13 general render functions, 20 map rendering functions, and a few structures that allow C/C++ gauges to be drawn into the provided in-game bitmap. All the functions use a ctx parameter of type FsContext which is provided as an argument of the gauge callback. More information can be found from the links provided below for the various functions and structures.

 

You can find a sample project to use as a reference when using the NanoVG API here:

 

 

Render Functions

These functions provide basic render support:

FunctionDescription
fsRenderCreateCreates a new rendering context in the sim.
fsRenderCreateTextureCreates a new texture.
fsRenderGetTextureSizeGets the specified texture size.
fsRenderClearStencilClears the stencil buffer of the specified context.
fsRenderFillFills the specified shapes.
fsRenderStrokeStrokes the specified shapes.
fsRenderTrianglesRenders the specified triangles.
fsRenderUpdateTextureUpdates part or all of a texture.
fsRenderViewportSpecifies the viewport to be used when drawing the gauge.
fsRenderFlushFlushes (executes) the current rendering commands.
fsRenderCancelCancels the current rendering commands.
fsRenderDeleteTextureDeletes a texture.
fsRenderDeleteDeletes the specified context.

 

 

Structures:

The following structs are used by various functions in the WASM low-level API.

StructureDescription
FsColorRepresents a typical color through its Red, Green, Blue and Alpha components.
FsCompositeOperationRepresents a composite operation used to combined a source pixel and a destination pixel into a final pixel.
FsPaintRepresents a color, gradient or image pattern used to fill shapes.
FsPathRepresents a shape to be drawn.
FsScissorRepresents a rectangular region, potentially transformed, that can be used as a mask.
FsVertexRepresents a typical 2D vertex.