UI

public class UI

Provides functionality for drawing and interacting with in-game user interface elements.

Canvas getStockCanvas()

The stock UI canvas.

Canvas addCanvas()

Add a new canvas.

Note

If you want to add UI elements to KSPs stock UI canvas, use getStockCanvas().

void message(String content, float duration, MessagePosition position, org.javatuples.Triplet<Double, Double, Double> color, float size)

Display a message on the screen.

Parameters:
  • content (String) – Message content.

  • duration (float) – Duration before the message disappears, in seconds.

  • position (MessagePosition) – Position to display the message.

  • color (org.javatuples.Triplet) – The color of the message.

  • size (float) – Size of the message, differs per position.

Note

The message appears just like a stock message, for example quicksave or quickload messages.

void clear(boolean clientOnly)

Remove all user interface elements.

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

public enum MessagePosition

Message position.

public MessagePosition TOP_LEFT

Top left.

public MessagePosition TOP_CENTER

Top center.

public MessagePosition TOP_RIGHT

Top right.

public MessagePosition BOTTOM_CENTER

Bottom center.