Drawing#

Provides functionality for drawing objects in the flight scene, the map view, the editor and the tracking station.

Note

For drawing and interacting with the user interface, see the UI service. Objects drawn by a client are removed when that client disconnects.

krpc_error_t krpc_Drawing_AddLine(krpc_connection_t connection, krpc_Drawing_Line_t *returnValue, const krpc_tuple_double_double_double_t *start, const krpc_tuple_double_double_double_t *end, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, bool visible)#

Draw a line in the scene.

Parameters:
  • start – Position of the start of the line.

  • end – Position of the end of the line.

  • referenceFrame – Reference frame that the positions are in.

  • visible – Whether the line is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddDirection(krpc_connection_t connection, krpc_Drawing_Line_t *returnValue, const krpc_tuple_double_double_double_t *direction, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, float length, bool visible)#

Draw a direction vector in the scene, starting from the origin of the given reference frame.

Parameters:
  • direction – Direction to draw the line in.

  • referenceFrame – Reference frame that the direction is in and defines the start position.

  • length – The length of the line.

  • visible – Whether the line is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddDirectionFromCom(krpc_connection_t connection, krpc_Drawing_Line_t *returnValue, const krpc_tuple_double_double_double_t *direction, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, float length, bool visible)#

Draw a direction vector in the scene, from the center of mass of the active vessel.

Parameters:
  • direction – Direction to draw the line in.

  • referenceFrame – Reference frame that the direction is in.

  • length – The length of the line.

  • visible – Whether the line is visible.

Game Scenes:

Flight

krpc_error_t krpc_Drawing_AddAxes(krpc_connection_t connection, krpc_list_object_t *returnValue, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, float length, bool visible)#

Draw the axes of a reference frame in the scene, as arrows from its origin.

Parameters:
  • referenceFrame – The reference frame.

  • length – The length of each axis.

  • visible – Whether the axes are visible.

Returns:

The lines for the x, y and z axes, colored red, green and blue.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddPolygon(krpc_connection_t connection, krpc_Drawing_Polygon_t *returnValue, const krpc_list_tuple_double_double_double_t *vertices, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, bool visible)#

Draw a polygon in the scene, defined by a list of vertices.

Parameters:
  • vertices – Vertices of the polygon.

  • referenceFrame – Reference frame that the vertices are in.

  • visible – Whether the polygon is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddPolyline(krpc_connection_t connection, krpc_Drawing_Polyline_t *returnValue, const krpc_list_tuple_double_double_double_t *vertices, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, bool visible)#

Draw an open line through a list of vertices in the scene.

Parameters:
  • vertices – Vertices of the line.

  • referenceFrame – Reference frame that the vertices are in.

  • visible – Whether the line is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddCircle(krpc_connection_t connection, krpc_Drawing_Circle_t *returnValue, const krpc_tuple_double_double_double_t *center, const krpc_tuple_double_double_double_t *normal, double radius, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, bool visible)#

Draw a circle in the scene.

Parameters:
  • center – Position of the center of the circle.

  • normal – Normal of the plane of the circle.

  • radius – Radius of the circle, in meters.

  • referenceFrame – Reference frame that the position and normal are in.

  • visible – Whether the circle is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Note

Throws an exception if the normal is zero.

krpc_error_t krpc_Drawing_AddArc(krpc_connection_t connection, krpc_Drawing_Arc_t *returnValue, const krpc_tuple_double_double_double_t *center, const krpc_tuple_double_double_double_t *normal, const krpc_tuple_double_double_double_t *startDirection, double angle, double radius, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, bool visible)#

Draw an arc of a circle in the scene.

Parameters:
  • center – Position of the center of the arc.

  • normal – Normal of the plane of the arc.

  • startDirection – Direction from the center to the start of the arc.

  • angle – Angle of the arc, in radians.

  • radius – Radius of the arc, in meters.

  • referenceFrame – Reference frame that the position and directions are in.

  • visible – Whether the arc is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Note

The arc turns counterclockwise about the normal, seen from the side it points to. Throws an exception if the normal is zero, or the start direction is parallel to it.

krpc_error_t krpc_Drawing_AddOrbit(krpc_connection_t connection, krpc_Drawing_OrbitPath_t *returnValue, krpc_SpaceCenter_Orbit_t orbit, bool visible)#

Draw the path of an orbit in the scene.

Parameters:
  • orbit – The orbit.

  • visible – Whether the path is visible.

Game Scenes:

Flight, Tracking Station

Note

The path follows the orbit as it changes, and ends where the orbit leaves the sphere of influence of its body.

krpc_error_t krpc_Drawing_AddPoint(krpc_connection_t connection, krpc_Drawing_Point_t *returnValue, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, bool visible)#

Draw a point in the scene, as a dot that keeps its size on screen.

Parameters:
  • position – Position of the point.

  • referenceFrame – Reference frame that the position is in.

  • visible – Whether the point is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddBox(krpc_connection_t connection, krpc_Drawing_Box_t *returnValue, const krpc_tuple_double_double_double_t *center, const krpc_tuple_double_double_double_t *size, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, const krpc_tuple_double_double_double_double_t *rotation, bool visible)#

Draw the edges of a box in the scene.

Parameters:
  • center – Position of the center of the box.

  • size – Lengths of the sides of the box along its x, y and z axes, in meters.

  • referenceFrame – Reference frame that the position and rotation are in.

  • rotation – Rotation of the box, as a quaternion.

  • visible – Whether the box is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddSphere(krpc_connection_t connection, krpc_Drawing_Sphere_t *returnValue, const krpc_tuple_double_double_double_t *center, double radius, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, bool visible)#

Draw a solid sphere in the scene.

Parameters:
  • center – Position of the center of the sphere.

  • radius – Radius of the sphere, in meters.

  • referenceFrame – Reference frame that the position is in.

  • visible – Whether the sphere is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddText(krpc_connection_t connection, krpc_Drawing_Text_t *returnValue, const char *text, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, const krpc_tuple_double_double_double_t *position, const krpc_tuple_double_double_double_double_t *rotation, bool visible)#

Draw text in the scene.

Parameters:
  • text – The string to draw.

  • referenceFrame – Reference frame that the text position is in.

  • position – Position of the text.

  • rotation – Rotation of the text, as a quaternion.

  • visible – Whether the text is visible.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

krpc_error_t krpc_Drawing_AddNavballMarker(krpc_connection_t connection, krpc_Drawing_NavballMarker_t *returnValue, const krpc_tuple_double_double_double_t *direction, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, bool visible)#

Draw a marker on the navball, pointing in the given direction.

Parameters:
  • direction – Direction that the marker points in.

  • referenceFrame – Reference frame that the direction is in.

  • visible – Whether the marker is visible.

Game Scenes:

Flight

krpc_error_t krpc_Drawing_AddMapMarker(krpc_connection_t connection, krpc_Drawing_MapMarker_t *returnValue, const krpc_tuple_double_double_double_t *position, krpc_SpaceCenter_ReferenceFrame_t referenceFrame, krpc_Drawing_MapMarkerIcon_t icon, const char *caption, bool visible)#

Draw a marker in the map view, with one of the game’s own map icons.

Parameters:
  • position – Position of the marker.

  • referenceFrame – Reference frame that the position is in.

  • icon – The icon that the marker is drawn with.

  • caption – The caption shown when the mouse is over the marker.

  • visible – Whether the marker is visible.

Game Scenes:

Flight, Tracking Station

krpc_error_t krpc_Drawing_AddImage(krpc_connection_t connection, krpc_Drawing_Image_t *returnValue, krpc_bytes_t data)#

Load an image that markers can be drawn with, from the contents of a PNG or JPEG file. The transparency of a PNG image is kept.

Parameters:
  • data – The contents of the image file.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph

Note

Throws an exception if the data is not a PNG or JPEG image.

krpc_error_t krpc_Drawing_Clear(krpc_connection_t connection, bool clientOnly)#

Remove all objects being drawn.

Parameters:
  • clientOnly – If true, only remove objects created by the calling client.

Game Scenes:

Flight, Tracking Station, Editor Vab, Editor Sph