XPLMCreateMapLayer_t

This structure defines all of the parameters used to create a map layer using XPLMCreateMapLayer. The structure will be expanded in future SDK APIs to include more features. Always set the structSize member to the size of your struct in bytes!

Each layer must be associated with exactly one map instance in X-Plane. That map, and that map alone, will call your callbacks. Likewise, when that map is deleted, your layer will be as well.

typedef struct {
     // Used to inform XPLMCreateMapLayer() of the SDK version you compiled against; should always be set to sizeof(XPLMCreateMapLayer_t)
     int                       structSize;
     // Globally unique string identifying the map you want this layer to appear in. As of XPLM300, this is limited to one of XPLM_MAP_USER_INTERFACE or XPLM_MAP_IOS
     const char *              mapToCreateLayerIn;
     // The type of layer you are creating, used to determine draw order (all plugin-created markings layers are drawn above all plugin-created fill layers)
     XPLMMapLayerType          layerType;
     // Optional callback to inform you this layer is being deleted (due to its owning map being destroyed)
     XPLMMapWillBeDeletedCallback_f willBeDeletedCallback;
     // Optional callback you want to use to prepare your draw cache when the map bounds change (set to NULL if you don't want this callback)
     XPLMMapPrepareCacheCallback_f prepCacheCallback;
     // Optional callback you want to use for arbitrary OpenGL drawing, which goes beneath all icons in the map's layering system (set to NULL if you don't want this callback)
     XPLMMapDrawingCallback_f  drawCallback;
     // Optional callback you want to use for drawing icons, which go above all built-in X-Plane icons (except the aircraft) in the map's layering system (set to NULL if you don't want this callback)
     XPLMMapIconDrawingCallback_f iconCallback;
     // Optional callback you want to use for drawing map labels, which go above all built-in X-Plane icons and labels (except those of aircraft) in the map's layering system (set to NULL if you don't want this callback)
     XPLMMapLabelDrawingCallback_f labelCallback;
     // True if you want a checkbox to be created in the map UI to toggle this layer on and off; false if the layer should simply always be enabled
     int                       showUiToggle;
     // Short label to use for this layer in the user interface
     const char *              layerName;
     // A reference to arbitrary data that will be passed to your callbacks
     void *                    refcon;
} XPLMCreateMapLayer_t;