XPMP2
X-Plane multiplayer library 2 - using instancing
Namespaces | Macros | Functions
2D.cpp File Reference

Implementation of 2-D routines, like drawing aircraft labels. More...

#include "XPMP2.h"

Namespaces

 XPMP2
 

Macros

#define DEBUG_ENABLE_AC_LABELS   "Aircraft labels %s"
 

Functions

void XPMP2::TwoDDrawLabels ()
 Write the labels of all aircraft. More...
 
int XPMP2::CPLabelDrawing (XPLMDrawingPhase, int, void *)
 Drawing callback, called by X-Plane in every drawing cycle. More...
 
void XPMP2::TwoDActivate ()
 Activate actual label drawing, esp. set up drawing callback. More...
 
void XPMP2::TwoDDeactivate ()
 Deactivate actual label drawing, esp. stop drawing callback. More...
 
void XPMP2::TwoDInit ()
 Initialize the module. More...
 
void XPMP2::TwoDCleanup ()
 Grace cleanup. More...
 
void XPMPEnableAircraftLabels (bool _enable)
 Enable or disable drawing of labels with the aircraft. More...
 
void XPMPDisableAircraftLabels ()
 Disable drawing of labels with the aircraft. More...
 
bool XPMPDrawingAircraftLabels ()
 Returns if labels are currently configured to be drawn. More...
 
void XPMPSetAircraftLabelDist (float _dist_nm, bool _bCutOffAtVisibility)
 

Detailed Description

Implementation of 2-D routines, like drawing aircraft labels.

2-D drawing is a bit "unnatural" as the aircraft are put into a 3-D world. These functions require to turn 3D coordinates into 2D coordinates.

See also
Laminar's sample code at https://developer.x-plane.com/code-sample/coachmarks/ is the basis, then been taken apart.
Author
Laminar Research
Birger Hoppe

Macro Definition Documentation

◆ DEBUG_ENABLE_AC_LABELS

#define DEBUG_ENABLE_AC_LABELS   "Aircraft labels %s"

Function Documentation

◆ XPMPDisableAircraftLabels()

void XPMPDisableAircraftLabels ( )

Disable drawing of labels with the aircraft.

Effectively calls XPMPEnableAircraftLabels()

◆ XPMPDrawingAircraftLabels()

bool XPMPDrawingAircraftLabels ( )

Returns if labels are currently configured to be drawn.

◆ XPMPEnableAircraftLabels()

void XPMPEnableAircraftLabels ( bool  _enable)

Enable or disable drawing of labels with the aircraft.

◆ XPMPSetAircraftLabelDist()

void XPMPSetAircraftLabelDist ( float  _dist_nm,
bool  _bCutOffAtVisibility = true 
)

Configure maximum label distance and if labels shall be cut off at reported visibility

Parameters
_dist_nmMaximum label distance in nm, default is 3, minimum is 1
_bCutOffAtVisibilityShall labels not be drawn further away than XP's reported visibility?