Interface
Functions
Section titled “Functions”Adds a column to the current layout with width width. - Positive values of width just specify the width in pixels. - 0 means use the default control width - not always a good choice. - Negative values specify filling to the right until width + 1 pixels away from the edge. - e.g -1 fills entirely to the right, while -20 leaves a 19 pixel gap on the right.
Parameters:
| Name | Type | Description |
|---|---|---|
| width | Integer | Width of the column in pixels |
Signatures:
void add_column(int width)public static void SplashKit.AddColumn(int width);def add_column(width):procedure AddColumn(width: Integer)Adds a column to the current layout with width width percentage of the container’s width.
Parameters:
| Name | Type | Description |
|---|---|---|
| width | Double | Percentage of the container’s width (between 0 and 1) |
Signatures:
void add_column_relative(double width)public static void SplashKit.AddColumnRelative(double width);def add_column_relative(width):procedure AddColumnRelative(width: Double)Creates a button with a bitmap in it, and no label. Returns whether the button was clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| bmp | Bitmap | The bitmap to show inside the button |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool bitmap_button(bitmap bmp)public static bool SplashKit.BitmapButton(Bitmap bmp);def bitmap_button(bmp):function BitmapButton(bmp: Bitmap): BooleanCreates a button with a bitmap in it at a specific position on screen. Returns whether the button was clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| bmp | Bitmap | The bitmap to show inside the button |
| rect | Rectangle | The rectangle to display the button in |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool bitmap_button(bitmap bmp, const rectangle &rect)public static bool SplashKit.BitmapButton(Bitmap bmp, Rectangle rect);def bitmap_button_at_position(bmp, rect):function BitmapButton(bmp: Bitmap; const rect: Rectangle): BooleanCreates a button with a bitmap in it at a specific position on screen. Returns whether the button was clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| bmp | Bitmap | The bitmap to show inside the button |
| rect | Rectangle | The rectangle to display the button in |
| opts | Drawing Options | The drawing options |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool bitmap_button(bitmap bmp, const rectangle &rect, drawing_options opts)public static bool SplashKit.BitmapButton(Bitmap bmp, Rectangle rect, DrawingOptions opts);def bitmap_button_at_position_with_options(bmp, rect, opts):function BitmapButton(bmp: Bitmap; const rect: Rectangle; opts: DrawingOptions): BooleanCreates a button with a bitmap in it, and no label. Returns whether the button was clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| bmp | Bitmap | The bitmap to show inside the button |
| opts | Drawing Options | The drawing options |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool bitmap_button(bitmap bmp, drawing_options opts)public static bool SplashKit.BitmapButton(Bitmap bmp, DrawingOptions opts);def bitmap_button_with_options(bmp, opts):function BitmapButton(bmp: Bitmap; opts: DrawingOptions): BooleanCreates a button with a bitmap in it and a label. Returns whether the button was clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in front of the button |
| bmp | Bitmap | The bitmap to show inside the button |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool bitmap_button(const string &label_text, bitmap bmp)public static bool SplashKit.BitmapButton(string labelText, Bitmap bmp);def bitmap_button_labeled(label_text, bmp):function BitmapButton(const labelText: String; bmp: Bitmap): BooleanCreates a button with a bitmap in it and a label. Returns whether the button was clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in front of the button |
| bmp | Bitmap | The bitmap to show inside the button |
| opts | Drawing Options | The drawing options |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool bitmap_button(const string &label_text, bitmap bmp, drawing_options opts)public static bool SplashKit.BitmapButton(string labelText, Bitmap bmp, DrawingOptions opts);def bitmap_button_labeled_with_options(label_text, bmp, opts):function BitmapButton(const labelText: String; bmp: Bitmap; opts: DrawingOptions): BooleanCreates a button at a specific position on screen. Returns whether the button was clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String | The text to show inside the button |
| rect | Rectangle | The rectangle to display the button in |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool button(const string &text, const rectangle &rect)public static bool SplashKit.Button(string text, Rectangle rect);def button_at_position(text, rect):function Button(const text: String; const rect: Rectangle): BooleanUsage: {</>}
Creates a button without a label. Returns whether the button was clicked.
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String | The text to show inside the button |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool button(const string &text)public static bool SplashKit.Button(string text);def button(text):function Button(const text: String): BooleanCreates a button with a label. Returns whether the button was clicked. Example usage: c++ // Test if clicked: if (button("Button 1", "Click me!")) { // do stuff.. }
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in front of the button |
| text | String | The text to show inside the button |
Return Type: Boolean
Returns: Whether the button was clicked
Signatures:
bool button(const string &label_text, const string &text)public static bool SplashKit.Button(string labelText, string text);def button_labeled(label_text, text):function Button(const labelText: String; const text: String): BooleanCreates a checkbox at a specific position on screen. Returns the updated value of the checkbox.
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String | The text to show next to the checkbox |
| value | Boolean | The current value of the checkbox |
| rect | Rectangle | The rectangle to display the checkbox in |
Return Type: Boolean
Returns: The updated value of the checkbox
Signatures:
bool checkbox(const string &text, const bool &value, const rectangle &rect)public static bool SplashKit.Checkbox(string text, bool value, Rectangle rect);def checkbox_at_position(text, value, rect):function Checkbox(const text: String; const value: Boolean; const rect: Rectangle): BooleanCreates a checkbox. Returns the updated value of the checkbox.
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String | The text to show next to the checkbox |
| value | Boolean | The current value of the checkbox |
Return Type: Boolean
Returns: The updated value of the checkbox
Signatures:
bool checkbox(const string &text, const bool &value)public static bool SplashKit.Checkbox(string text, bool value);def checkbox(text, value):function Checkbox(const text: String; const value: Boolean): BooleanCreates a checkbox with a label. Returns the updated value of the checkbox. Example usage: c++ my_bool = checkbox("Checkbox 1", "Enabled?", my_bool);
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in front of the checkbox |
| text | String | The text to show next to the checkbox |
| value | Boolean | The current value of the checkbox |
Return Type: Boolean
Returns: The updated value of the checkbox
Signatures:
bool checkbox(const string &label_text, const string &text, const bool &value)public static bool SplashKit.Checkbox(string labelText, string text, bool value);def checkbox_labeled(label_text, text, value):function Checkbox(const labelText: String; const text: String; const value: Boolean): BooleanCreates a set of RGBA sliders to adjust a color, at a specific position on screen. Returns the updated color value of the slider.
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The current value of the color slider |
| rect | Rectangle | The rectangle to display the slider in. |
Return Type: Color
Returns: The updated value of the slider
Signatures:
color color_slider(const color &clr, const rectangle &rect)public static Color SplashKit.ColorSlider(Color clr, Rectangle rect);def color_slider_at_position(clr, rect):function ColorSlider(const clr: Color; const rect: Rectangle): ColorCreates a set of RGBA sliders to adjust a color. Returns the updated color value of the slider.
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The current value of the color slider |
Return Type: Color
Returns: The updated value of the slider
Signatures:
color color_slider(const color &clr)public static Color SplashKit.ColorSlider(Color clr);def color_slider(clr):function ColorSlider(const clr: Color): ColorCreates a set of RGBA sliders to adjust a color, with a label. Returns the updated color value of the slider. Example usage: c++ my_color = color_slider("Player Color", my_color);
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in front of the slider |
| clr | Color | The current value of the color slider |
Return Type: Color
Returns: The updated value of the slider
Signatures:
color color_slider(const string &label_text, const color &clr)public static Color SplashKit.ColorSlider(string labelText, Color clr);def color_slider_labeled(label_text, clr):function ColorSlider(const labelText: String; const clr: Color): ColorDisables the interface temporarily. Elements created after this function will appear disabled and cannot be interacted with.
Signatures:
void disable_interface()public static void SplashKit.DisableInterface();def disable_interface():procedure DisableInterface()Draws the user interface that all the previous calls (such as Start Panel, Button, etc) have created. Make sure to call this! Without calling it, the interface won’t be visible.
Signatures:
void draw_interface()public static void SplashKit.DrawInterface();def draw_interface():procedure DrawInterface()Usage: {</>}
Re-enables the interface, reverses the effects of disabling the interface.
Signatures:
void enable_interface()public static void SplashKit.EnableInterface();def enable_interface():procedure EnableInterface()Finishes the creation of an inset area.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The area’s name - must match with Start Inset |
Signatures:
void end_inset(const string &name)public static void SplashKit.EndInset(string name);def end_inset(name):procedure EndInset(const name: String)Finishes the creation of a panel.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name shown in the panel’s titlebar - must match with Start Panel |
Signatures:
void end_panel(const string &name)public static void SplashKit.EndPanel(string name);def end_panel(name):procedure EndPanel(const name: String)Finishes the creation of a popup.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The popup’s name - must match with Start Popup |
Signatures:
void end_popup(const string &name)public static void SplashKit.EndPopup(string name);def end_popup(name):procedure EndPopup(const name: String)Finishes the creation of a tree node.
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The node’s name - must match with Start Treenode |
Signatures:
void end_treenode(const string &label_text)public static void SplashKit.EndTreenode(string labelText);def end_treenode(label_text):procedure EndTreenode(const labelText: String)Begins placing elements inside the current column. Must be paired with a call to Leave Column.
Signatures:
void enter_column()public static void SplashKit.EnterColumn();def enter_column():procedure EnterColumn()Returns the width of element labels. Default is 60 pixels.
Return Type: Integer
Returns: The width of labels
Signatures:
int get_interface_label_width()public static int SplashKit.GetInterfaceLabelWidth();def get_interface_label_width():function GetInterfaceLabelWidth(): IntegerCreates a collapsable header with a label. Returns whether the header is expanded or not. Note: Unlike Start Panel and other similar functions, there is no need to ‘end’ this one. Example usage: c++ if (header("Section A")) { // elements inside header go here }
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in the header |
Return Type: Boolean
Returns: Whether the header is expanded or not
Signatures:
bool header(const string &label_text)public static bool SplashKit.Header(string labelText);def header(label_text):function Header(const labelText: String): BooleanCreates a set of HSBA (hue, saturation, brightness, alpha) sliders to adjust a color, at a specific position on screen. Returns the updated color value of the slider.
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The current value of the color slider |
| rect | Rectangle | The rectangle to display the slider in. |
Return Type: Color
Returns: The updated value of the slider
Signatures:
color hsb_color_slider(const color &clr, const rectangle &rect)public static Color SplashKit.HSBColorSlider(Color clr, Rectangle rect);def hsb_color_slider_at_position(clr, rect):function HSBColorSlider(const clr: Color; const rect: Rectangle): ColorCreates a set of HSBA (hue, saturation, brightness, alpha) sliders to adjust a color. Returns the updated color value of the slider.
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The current value of the color slider |
Return Type: Color
Returns: The updated value of the slider
Signatures:
color hsb_color_slider(const color &clr)public static Color SplashKit.HSBColorSlider(Color clr);def hsb_color_slider(clr):function HSBColorSlider(const clr: Color): ColorCreates a set of HSBA (hue, saturation, brightness, alpha) sliders to adjust a color, with a label. Returns the updated color value of the slider. Example usage: c++ my_color = hsb_color_slider("Player Color", my_color);
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in front of the slider |
| clr | Color | The current value of the color slider |
Return Type: Color
Returns: The updated value of the slider
Signatures:
color hsb_color_slider(const string &label_text, const color &clr)public static Color SplashKit.HSBColorSlider(string labelText, Color clr);def hsb_color_slider_labeled(label_text, clr):function HSBColorSlider(const labelText: String; const clr: Color): ColorReturns if the interface is currently enabled or not.
Return Type: Boolean
Returns: Whether the interface is currently enabled or not
Signatures:
bool interface_enabled()public static bool SplashKit.InterfaceEnabled();def interface_enabled():function InterfaceEnabled(): BooleanA utility function to show a ‘Style Panel’, which will allows you to experiment with different interface styles.
Parameters:
| Name | Type | Description |
|---|---|---|
| initial_rectangle | Rectangle | The initial position/size the panel starts off in |
Signatures:
void interface_style_panel(const rectangle &initial_rectangle)public static void SplashKit.InterfaceStylePanel(Rectangle initialRectangle);def interface_style_panel(initial_rectangle):procedure InterfaceStylePanel(const initialRectangle: Rectangle)Creates a label with the given text.
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String | The label to show |
Signatures:
void label_element(const string &text)public static void SplashKit.LabelElement(string text);def label_element(text):procedure LabelElement(const text: String)Creates a label at a specific position on screen.
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String | The label to show |
| rect | Rectangle | The rectangle to display the label in |
Signatures:
void label_element(const string &text, const rectangle &rect)public static void SplashKit.LabelElement(string text, Rectangle rect);def label_element_at_position(text, rect):procedure LabelElement(const text: String; const rect: Rectangle)Returns if the last created element was changed at all (such as dragged, typed in, etc)
Return Type: Boolean
Returns: Whether the last created element was changed
Signatures:
bool last_element_changed()public static bool SplashKit.LastElementChanged();def last_element_changed():function LastElementChanged(): BooleanReturns if the last created element was ‘confirmed’ (such as clicking a button, or hitting enter in a text box)
Return Type: Boolean
Returns: Whether the last created element was confirmed
Signatures:
bool last_element_confirmed()public static bool SplashKit.LastElementConfirmed();def last_element_confirmed():function LastElementConfirmed(): BooleanStops placing elements inside the current column and moves to the next one.
Signatures:
void leave_column()public static void SplashKit.LeaveColumn();def leave_column():procedure LeaveColumn()Creates a number entry box at a specific position on screen. Returns the updated value of the number box.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | Float | The current value of the number box |
| step | Float | The amount incremented when dragging on the box |
| rect | Rectangle | The rectangle to display the slider in |
Return Type: Float
Returns: The updated value of the slider
Signatures:
float number_box(const float &value, float step, const rectangle &rect)public static float SplashKit.NumberBox(float value, float step, Rectangle rect);def number_box_at_position(value, step, rect):function NumberBox(const value: Single; step: Single; const rect: Rectangle): SingleCreates a number entry box with a label. Returns the updated value of the number box.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | Float | The current value of the number box |
| step | Float | The amount incremented when dragging on the box |
Return Type: Float
Returns: The updated value of the slider
Signatures:
float number_box(const float &value, float step)public static float SplashKit.NumberBox(float value, float step);def number_box(value, step):function NumberBox(const value: Single; step: Single): SingleCreates a number entry box with a label. Returns the updated value of the number box. Example usage: c++ my_float = number_box("Percentage", my_float, 1);
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in front of the number box |
| value | Float | The current value of the number box |
| step | Float | The amount incremented when dragging on the box |
Return Type: Float
Returns: The updated value of the slider
Signatures:
float number_box(const string &label_text, const float &value, float step)public static float SplashKit.NumberBox(string labelText, float value, float step);def number_box_labeled(label_text, value, step):function NumberBox(const labelText: String; const value: Single; step: Single): SingleMakes the popup named name open/popup at the cursor’s position.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The popup’s name. Must match with the same name used in Start Popup |
Signatures:
void open_popup(const string &name)public static void SplashKit.OpenPopup(string name);def open_popup(name):procedure OpenPopup(const name: String)Creates a paragraph of text that auto-wraps.
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String | The text to show |
Signatures:
void paragraph(const string &text)public static void SplashKit.Paragraph(string text);def paragraph(text):procedure Paragraph(const text: String)Creates a paragraph of text that auto-wraps at a specific position on screen.
Parameters:
| Name | Type | Description |
|---|---|---|
| text | String | The text to show |
| rect | Rectangle | The rectangle to display the label in |
Signatures:
void paragraph(const string &text, const rectangle &rect)public static void SplashKit.Paragraph(string text, Rectangle rect);def paragraph_at_position(text, rect):procedure Paragraph(const text: String; const rect: Rectangle)Resets to the default layout of a single column with default height.
Signatures:
void reset_layout()public static void SplashKit.ResetLayout();def reset_layout():procedure ResetLayout()Sets the color of accents in the interface, and the contrast of how strongly they appear when hovering/interacting.
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The color of accents |
| contrast | Float | The strength of how much the accents show (between 0 and 1) |
Signatures:
void set_interface_accent_color(color clr, float contrast)public static void SplashKit.SetInterfaceAccentColor(Color clr, float contrast);def set_interface_accent_color(clr, contrast):procedure SetInterfaceAccentColor(clr: Color; contrast: Single)Sets the interface’s border color.
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The color to set borders to |
Signatures:
void set_interface_border_color(color clr)public static void SplashKit.SetInterfaceBorderColor(Color clr);def set_interface_border_color(clr):procedure SetInterfaceBorderColor(clr: Color)A convenience function to set the majority of the interface’s colors in one go. Some colors will be automatically chosen based on the parameters (such as text color).
Parameters:
| Name | Type | Description |
|---|---|---|
| main_clr | Color | The main color of the interface - also decides if the interface is light or dark mode |
| accent_clr | Color | The color used to accent the interface - this will appear in highlighted areas |
| contrast | Float | The contrast between the frames of elements/containers and their internal elements |
| accent_contrast | Float | How strongly the accent color is used, for instance when highlighting elements |
| border_contrast | Float | Simply the opacity of the borders |
Signatures:
void set_interface_colors_auto(color main_clr, color accent_clr, float contrast, float accent_contrast, float border_contrast)public static void SplashKit.SetInterfaceColorsAuto(Color mainClr, Color accentClr, float contrast, float accentContrast, float borderContrast);def set_interface_colors_auto(main_clr, accent_clr, contrast, accent_contrast, border_contrast):procedure SetInterfaceColorsAuto(mainClr: Color; accentClr: Color; contrast: Single; accentContrast: Single; borderContrast: Single)Sets the main color of elements in the interface, and the contrast between their frame and internal pieces.
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The color of elements |
| contrast | Float | The contrast between the frame of elements and their internal pieces (between 0 and 1) |
Signatures:
void set_interface_element_color(color clr, float contrast)public static void SplashKit.SetInterfaceElementColor(Color clr, float contrast);def set_interface_element_color(clr, contrast):procedure SetInterfaceElementColor(clr: Color; contrast: Single)Sets the style of element’s shadows. Use a fully transparent color to disable them.
Parameters:
| Name | Type | Description |
|---|---|---|
| radius | Integer | The radius of the shadow’s blur |
| clr | Color | The color of the shadows (commonly black, but can do coloured and semi-transparent too) |
| offset | Point 2d | The offset in x/y coordinates of the shadows from their casting elements |
Signatures:
void set_interface_element_shadows(int radius, color clr, point_2d offset)public static void SplashKit.SetInterfaceElementShadows(int radius, Color clr, Point2D offset);def set_interface_element_shadows(radius, clr, offset):procedure SetInterfaceElementShadows(radius: Integer; clr: Color; offset: Point2D)Sets the interface’s font.
Parameters:
| Name | Type | Description |
|---|---|---|
| fnt | String | The name of the font to be used |
Signatures:
void set_interface_font(const string &fnt)public static void SplashKit.SetInterfaceFont(string fnt);def set_interface_font_font_as_string(fnt):procedure SetInterfaceFont(const fnt: String)Sets the interface’s font.
Parameters:
| Name | Type | Description |
|---|---|---|
| fnt | Font | The font to be used |
Signatures:
void set_interface_font(font fnt)public static void SplashKit.SetInterfaceFont(Font fnt);def set_interface_font(fnt):procedure SetInterfaceFont(fnt: Font)Sets the interface’s font size.
Parameters:
| Name | Type | Description |
|---|---|---|
| size | Integer | The font size to be used |
Signatures:
void set_interface_font_size(int size)public static void SplashKit.SetInterfaceFontSize(int size);def set_interface_font_size(size):procedure SetInterfaceFontSize(size: Integer)Sets the width of element labels. This is the maximum width in pixels that a label can span in front of an element. Default is 60 pixels.
Parameters:
| Name | Type | Description |
|---|---|---|
| width | Integer | The width of labels |
Signatures:
void set_interface_label_width(int width)public static void SplashKit.SetInterfaceLabelWidth(int width);def set_interface_label_width(width):procedure SetInterfaceLabelWidth(width: Integer)Sets the style of panel’s shadows. Use a fully transparent color to disable them.
Parameters:
| Name | Type | Description |
|---|---|---|
| radius | Integer | The radius of the shadow’s blur |
| clr | Color | The color of the shadows (commonly black, but can do coloured and semi-transparent too) |
| offset | Point 2d | The offset in x/y coordinates of the shadows from their casting elements |
Signatures:
void set_interface_panel_shadows(int radius, color clr, point_2d offset)public static void SplashKit.SetInterfacePanelShadows(int radius, Color clr, Point2D offset);def set_interface_panel_shadows(radius, clr, offset):procedure SetInterfacePanelShadows(radius: Integer; clr: Color; offset: Point2D)Sets color of text drawn directly onto the main window
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The color to set text drawn on the main window to |
Signatures:
void set_interface_root_text_color(color clr)public static void SplashKit.SetInterfaceRootTextColor(Color clr);def set_interface_root_text_color(clr):procedure SetInterfaceRootTextColor(clr: Color)Sets the style of all interface shadows. Use a fully transparent color to disable them.
Parameters:
| Name | Type | Description |
|---|---|---|
| radius | Integer | The radius of the shadow’s blur |
| clr | Color | The color of the shadows (commonly black, but can do coloured and semi-transparent too) |
| offset | Point 2d | The offset in x/y coordinates of the shadows from their casting elements |
Signatures:
void set_interface_shadows(int radius, color clr, point_2d offset)public static void SplashKit.SetInterfaceShadows(int radius, Color clr, Point2D offset);def set_interface_shadows(radius, clr, offset):procedure SetInterfaceShadows(radius: Integer; clr: Color; offset: Point2D)Sets the spacing within the interface.
Parameters:
| Name | Type | Description |
|---|---|---|
| spacing | Integer | The distance between elements |
| padding | Integer | The padding within elements |
Signatures:
void set_interface_spacing(int spacing, int padding)public static void SplashKit.SetInterfaceSpacing(int spacing, int padding);def set_interface_spacing(spacing, padding):procedure SetInterfaceSpacing(spacing: Integer; padding: Integer)Sets the interface style to one of the presets in the interface_style enum.
Parameters:
| Name | Type | Description |
|---|---|---|
| style | Interface Style | The preset style to use |
Signatures:
void set_interface_style(interface_style style)public static void SplashKit.SetInterfaceStyle(InterfaceStyle style);def set_interface_style(style):procedure SetInterfaceStyle(style: InterfaceStyle)Sets the interface style to one of the presets in the interface_style enum. Also accepts a color used to customize the interface.
Parameters:
| Name | Type | Description |
|---|---|---|
| style | Interface Style | The preset style to use |
| clr | Color | The color to style the interface after |
Signatures:
void set_interface_style(interface_style style, color clr)public static void SplashKit.SetInterfaceStyle(InterfaceStyle style, Color clr);def set_interface_style_with_color(style, clr):procedure SetInterfaceStyle(style: InterfaceStyle; clr: Color)Sets the interface’s text color.
Parameters:
| Name | Type | Description |
|---|---|---|
| clr | Color | The color to set text to |
Signatures:
void set_interface_text_color(color clr)public static void SplashKit.SetInterfaceTextColor(Color clr);def set_interface_text_color(clr):procedure SetInterfaceTextColor(clr: Color)Sets the height of each row in the interface in pixels. 0 resets to default.
Parameters:
| Name | Type | Description |
|---|---|---|
| height | Integer | Height of rows in pixels |
Signatures:
void set_layout_height(int height)public static void SplashKit.SetLayoutHeight(int height);def set_layout_height(height):procedure SetLayoutHeight(height: Integer)Starts layouting all elements onto a single row. Reset with reset_layout().
Signatures:
void single_line_layout()public static void SplashKit.SingleLineLayout();def single_line_layout():procedure SingleLineLayout()Creates a slider at a specific position on screen. Returns the updated value of the slider.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | Float | The current value of the slider |
| min_value | Float | The minimum value of the slider |
| max_value | Float | The maximum value of the slider |
| rect | Rectangle | The rectangle to display the slider in |
Return Type: Float
Returns: The updated value of the slider
Signatures:
float slider(const float &value, float min_value, float max_value, const rectangle &rect)public static float SplashKit.Slider(float value, float minValue, float maxValue, Rectangle rect);def slider_at_position(value, min_value, max_value, rect):function Slider(const value: Single; minValue: Single; maxValue: Single; const rect: Rectangle): SingleUsage: {</>}
Creates a slider without a label. Returns the updated value of the slider.
Parameters:
| Name | Type | Description |
|---|---|---|
| value | Float | The current value of the slider |
| min_value | Float | The minimum value of the slider |
| max_value | Float | The maximum value of the slider |
Return Type: Float
Returns: The updated value of the slider
Signatures:
float slider(const float &value, float min_value, float max_value)public static float SplashKit.Slider(float value, float minValue, float maxValue);def slider(value, min_value, max_value):function Slider(const value: Single; minValue: Single; maxValue: Single): SingleCreates a slider with a label. Returns the updated value of the slider. Example usage: c++ my_float = slider("Percentage", my_float, 0, 100);
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The label to show in front of the slider |
| value | Float | The current value of the slider |
| min_value | Float | The minimum value of the slider |
| max_value | Float | The maximum value of the slider |
Return Type: Float
Returns: The updated value of the slider
Signatures:
float slider(const string &label_text, const float &value, float min_value, float max_value)public static float SplashKit.Slider(string labelText, float value, float minValue, float maxValue);def slider_labeled(label_text, value, min_value, max_value):function Slider(const labelText: String; const value: Single; minValue: Single; maxValue: Single): SingleAdds count columns to the current layout, with equal widths
Parameters:
| Name | Type | Description |
|---|---|---|
| count | Integer | Number of columns to add |
Signatures:
void split_into_columns(int count)public static void SplashKit.SplitIntoColumns(int count);def split_into_columns(count):procedure SplitIntoColumns(count: Integer)Adds count columns to the current layout, with equal widths. Has extra parameter last_width, which lets you specify a specific width (in pixels) for the last column.
Parameters:
| Name | Type | Description |
|---|---|---|
| count | Integer | Number of columns to add |
| last_width | Integer | The width of the last column in pixels |
Signatures:
void split_into_columns(int count, int last_width)public static void SplashKit.SplitIntoColumns(int count, int lastWidth);def split_into_columns_with_last_width(count, last_width):procedure SplitIntoColumns(count: Integer; lastWidth: Integer)Adds count columns to the current layout, with equal widths. Has extra parameter last_width, which lets you specify a specific width (relative to the width of the container, between 0 and 1) for the last column.
Parameters:
| Name | Type | Description |
|---|---|---|
| count | Integer | Number of columns to add |
| last_width | Double | The width of the last column as percentage of the container’s width (between 0 and 1) |
Signatures:
void split_into_columns_relative(int count, double last_width)public static void SplashKit.SplitIntoColumnsRelative(int count, double lastWidth);def split_into_columns_relative_with_last_width(count, last_width):procedure SplitIntoColumnsRelative(count: Integer; lastWidth: Double)Clears the default layout so that a custom layout can be made.
Signatures:
void start_custom_layout()public static void SplashKit.StartCustomLayout();def start_custom_layout():procedure StartCustomLayout()Starts the creation of an inset area inside an arbitrary rectangle. The function must be accompanied by a call to End Inset with the same name.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the area |
| rect | Rectangle | The rectangle for the inset |
Signatures:
void start_inset(const string &name, const rectangle &rect)public static void SplashKit.StartInset(string name, Rectangle rect);def start_inset_at_position(name, rect):procedure StartInset(const name: String; const rect: Rectangle)Starts the creation of an inset area inside a panel/popup. Use as follows: c++ start_inset("Inset area", 60); // elements inside area goes here end_inset("Inset area"); The function must be accompanied by a call to End Inset with the same name.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the area |
| height | Integer | Height of the inset area in pixels. -1 fills entire space. Use negative heights to fill up to height away from the bottom |
Signatures:
void start_inset(const string &name, int height)public static void SplashKit.StartInset(string name, int height);def start_inset(name, height):procedure StartInset(const name: String; height: Integer)Starts the creation of a draggable panel with a title bar. Returns whether the panel is visible or not. Use as follows: c++ if (start_panel("My panel", rectangle_from(0,0,100,100))) { // Rest of interface goes here end_panel("My panel"); } After calling this, you can then call functions to add elements such as buttons and text boxes inside the panel. The function must be accompanied by a call to End Panel, that is only called if the panel is visible, and is passed the same name.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name shown in the panel’s titlebar |
| initial_rectangle | Rectangle | The initial position/size the panel starts off in |
Return Type: Boolean
Returns: Whether the panel is visible or not
Signatures:
bool start_panel(const string &name, rectangle initial_rectangle)public static bool SplashKit.StartPanel(string name, Rectangle initialRectangle);def start_panel(name, initial_rectangle):function StartPanel(const name: String; initialRectangle: Rectangle): BooleanStarts the creation of a popup. Returns whether the popup is visible or not. Usage is the same as Start Panel, other than the ‘starting rectangle’ will be automatically calculated. The function must be accompanied by a call to End Popup with the same name.
Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | The name of the popup |
Return Type: Boolean
Returns: Whether the popup is visible or not
Signatures:
bool start_popup(const string &name)public static bool SplashKit.StartPopup(string name);def start_popup(name):function StartPopup(const name: String): BooleanStarts the creation of a tree node (such as those in a file tree view). Returns whether the tree node is expanded or not. Usage is the same as Start Panel. The function must be accompanied by a call to End Treenode with the same name.
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | The name of the node |
Return Type: Boolean
Returns: Whether the tree node is expanded or not
Signatures:
bool start_treenode(const string &label_text)public static bool SplashKit.StartTreenode(string labelText);def start_treenode(label_text):function StartTreenode(const labelText: String): BooleanCreates a text entry box at a specific position on screen. Returns the updated value of the text box. Example usage: c++ my_string = text_box("Name", my_string, rectangle_from(0,0,100,100));
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | Unique identifier for the text box (not drawn) |
| value | String | The current value of the text box |
| rect | Rectangle | The rectangle to display the button in |
Return Type: String
Returns: The updated value of the text box
Signatures:
string text_box(const string &label_text, const string &value, const rectangle &rect)public static string SplashKit.TextBox(string labelText, string value, Rectangle rect);def text_box_at_position(label_text, value, rect):function TextBox(const labelText: String; const value: String; const rect: Rectangle): StringUsage: {</>}
Creates a text entry box with a label. Returns the updated value of the text box. Example usage: c++ my_string = text_box("Name", my_string);
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | Unique identifier for the text box (not drawn) |
| value | String | The current value of the text box |
Return Type: String
Returns: The updated value of the text box
Signatures:
string text_box(const string &label_text, const string &value)public static string SplashKit.TextBox(string labelText, string value);def text_box(label_text, value):function TextBox(const labelText: String; const value: String): StringCreates a text entry box with a label that can be shown. Returns the updated value of the text box. Example usage: c++ my_string = text_box("Name", my_string, true);
Parameters:
| Name | Type | Description |
|---|---|---|
| label_text | String | Unique identifier for the text box (not drawn) |
| value | String | The current value of the text box |
| show_label | Boolean | Whether to show the label or not |
Return Type: String
Returns: The updated value of the text box
Signatures:
string text_box(const string &label_text, const string &value, bool show_label)public static string SplashKit.TextBox(string labelText, string value, bool showLabel);def text_box_labeled(label_text, value, show_label):function TextBox(const labelText: String; const value: String; showLabel: Boolean): String