NANOVG API

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:

Function Description
fsRenderCreate

Creates a new rendering context in the sim.

fsRenderCreateTexture Creates a new texture.
fsRenderGetTextureSize Gets the specified texture size.
fsRenderClearStencil Clears the stencil buffer of the specified context.
fsRenderFill Fills the specified shapes.
fsRenderStroke Strokes the specified shapes.
fsRenderTriangles Renders the specified triangles.
fsRenderUpdateTexture Updates part or all of a texture.
fsRenderViewport Specifies the viewport to be used when drawing the gauge.
fsRenderFlush Flushes (executes) the current rendering commands.
fsRenderCancel Cancels the current rendering commands.
fsRenderDeleteTexture Deletes a texture.
fsRenderDelete Deletes the specified context.

 

 

Structures:

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

Structure Description
FsColor

Represents a typical color through its Red, Green, Blue and Alpha components.

FsCompositeOperation Represents a composite operation used to combined a source pixel and a destination pixel into a final pixel.
FsPaint Represents a color, gradient or image pattern used to fill shapes.
FsPath Represents a shape to be drawn.
FsScissor Represents a rectangular region, potentially transformed, that can be used as a mask.
FsVertex Represents a typical 2D vertex.