UI#
-
class UI : public krpc::Service#
Provides functionality for drawing and interacting with in-game user interface elements.
Note
For drawing 3D objects in the flight scene, see the Drawing service. User interface elements created by a client are removed when that client disconnects, and when the game scene changes. A client that needs its interface in more than one scene must create it again in each of them.
-
Canvas add_canvas()#
Add a new canvas.
Note
If you want to add UI elements to KSPs stock UI canvas, use
stock_canvas().
-
void message(std::string content, float duration = 1.0f, MessagePosition position = MessagePosition::top_center, StdLib::ColorRGBA color = StdLib::ColorRGBA{1.0f, 0.92f, 0.016f, 1.0f}, float size = 2e+01f)#
Display a message on the screen.
- Parameters:
content – Message content.
duration – Duration before the message disappears, in seconds.
position – Position to display the message.
color – The color of the message.
size – Size of the message, differs per position.
Note
The message appears just like a stock message, for example quicksave or quickload messages.
-
void clear(bool client_only = false)#
Remove all user interface elements.
- Parameters:
client_only – If true, only remove objects created by the calling client.
-
Canvas add_canvas()#