XPLMDrawMapIconFromSheet

XPLM_API void       XPLMDrawMapIconFromSheet(
                         XPLMMapLayerID       layer,    
                         const char *         inPngPath,    
                         int                  s,    
                         int                  t,    
                         int                  ds,    
                         int                  dt,    
                         float                mapX,    
                         float                mapY,    
                         XPLMMapOrientation   orientation,    
                         float                rotationDegrees,    
                         float                mapWidth);    

Enables plugin-created map layers to draw PNG icons using X-Plane’s built-in icon drawing functionality. Only valid from within an XPLMIconDrawingCallback_t (but you can request an arbitrary number of icons to be drawn from within your callback).

X-Plane will automatically manage the memory for your texture so that it only has to be loaded from disk once as long as you continue drawing it per-frame. (When you stop drawing it, the memory may purged in a “garbage collection” pass, require a load from disk in the future.)

Instead of having X-Plane draw a full PNG, this method allows you to use UV coordinates to request a portion of the image to be drawn. This allows you to use a single texture load (of an icon sheet, for example) to draw many icons. Doing so is much more efficient than drawing a dozen different small PNGs.

The UV coordinates used here treat the texture you load as being comprised of a number of identically sized “cells.” You specify the width and height in cells (ds and dt, respectively), as well as the coordinates within the cell grid for the sub-image you’d like to draw.

Note that you can use different ds and dt values in subsequent calls with the same texture sheet. This enables you to use icons of different sizes in the same sheet if you arrange them properly in the PNG.

This function is only valid from within an XPLMIconDrawingCallback_t (but you can request an arbitrary number of icons to be drawn from within your callback).