-
Notifications
You must be signed in to change notification settings - Fork 283
Drawing
The Drawing component provides functionality for rendering graphics in the X-Plane environment. Currently, this includes writing a single text string on the screen, and rendering a sequence of waypoints in the X-Plane world.
###Types
####Waypoint A data struct containing a latitude, longitude, and altitude.
####Localpoint A data struct containing an OpenGL local X, Y, Z coordinate.
####Drawing Contains methods to manipulate what X-Plane Connect draws to the screen.
#####Drawing Methods
######ClearMessage
Signature: static void ClearMessage();
Clears the current message on the screen if any and unregisters the draw callback for message drawing.
######SetMessage
Signature: static void SetMessage(int x, int y, char* msg);
Sets a string to be drawn at a particular point on the screen. For simplicity of implementation, the (x, y) coordinate specified is the bottom left point of the first line of the message.
######AddWaypoints
Signature: static void AddWaypoints(Waypoint points[], size_t numPoints);
Adds a set of waypoints to the list of waypoints to be drawn.
######ClearWaypoints
Signature: static void ClearWaypoints();
Clears the set of waypoints that are drawn.
######RemoveWaypoints
Signature: static void RemoveWaypoints(Waypoint points[], size_t numPoints);
Removes a set of waypoints to the list of waypoints to be drawn.
###Internal Functions
####cmp
Signature: static int cmp(const void * a, const void * b)
A simple comparison function for std::size_t
needed for qsort
.
####gl_DrawCube
Signature: static void gl_drawCube(float x, float y, float z, float d)
Draws a cube centered at the given coordinate, which is d
meters away from
the player aircraft. The distance is used to scale the cubes so that they
appear to be approximately the same size on the screen.
####MessageDrawCallback Signature:
static int MessageDrawCallback(XPLMDrawingPhase inPhase,
int inIsBefore,
void * inRefcon)
Callback for performing the drawing of the string specified by SetMessage
.
####RouteDrawCallback Signature:
static int RouteDrawCallback(XPLMDrawingPhase inPhase,
int inIsBefore,
void * inRefcon)
Callback for performing the drawing waypoints.