Skip to content
This repository was archived by the owner on Dec 13, 2025. It is now read-only.

Sandbox.ModAPI.Ingame.IMyTextSurface

Morten Aune Lyrstad edited this page Feb 3, 2022 · 29 revisions

IndexNamespace Index

IMyTextSurface Interface

public interface IMyTextSurface

Describes one of block LCDs where you can write text or draw things (PB scripting interface)

Namespace: Sandbox.ModAPI.Ingame
Assembly: Sandbox.Common.dll

Inheritors:

Properties

Member Description
CurrentlyShownImage { get; } Gets image that is currently shown on the screen. Returns NULL if there are no images selected OR the screen is in text mode.
FontSize { get; set; } Gets or sets font size
FontColor { get; set; } Gets or sets font color
BackgroundColor { get; set; } Gets or sets background color
BackgroundAlpha { get; set; } Value for offscreen texture alpha channel - for PBR material it is metalness (should be 0) - for transparent texture it is opacity
ChangeInterval { get; set; } Gets or sets the change interval for selected textures
Font { get; set; } Gets or sets the font
Alignment { get; set; } How should the text be aligned
Script { get; set; } Currently running script
ContentType { get; set; } Type of content to be displayed on the screen.
SurfaceSize { get; } Gets size of the drawing surface.
TextureSize { get; } Gets size of the texture the drawing surface is rendered to.
PreserveAspectRatio { get; set; } Gets or sets preserve aspect ratio of images.
TextPadding { get; set; } Gets or sets text padding from all sides of the panel.
ScriptBackgroundColor { get; set; } Gets or sets background color used for scripts.
ScriptForegroundColor { get; set; } Gets or sets foreground color used for scripts.
Name { get; } Gets identifier name of this surface.
DisplayName { get; } Get localized name of this surface.

Methods

Member Description
WriteText(string, bool) Writes text to surface. If somebody opened LCD text in popup dialog, text can no longer be added to the surface. Resulting text must is capped with 100000 symbols
GetText() Gets current text that is written on surface. Allocates memory (StringBuilder.ToString())! This method doesn't allocate memory ReadText(StringBuilder, bool)
WriteText(StringBuilder, bool) Writes text to surface. If somebody opened LCD text in popup dialog, text can no longer be added to the surface. Resulting text must is capped with 100000 symbols
ReadText(StringBuilder, bool) Gets current text that is written on surface.
AddImageToSelection(string, bool) Adds image to list of shown images. You can get image ids by GetSelectedImages(List<System.String>)
AddImagesToSelection(List, bool) Adds image to list of shown images. You can get image ids by GetSelectedImages(List<System.String>)
RemoveImageFromSelection(string, bool) Removes image from shown images.
RemoveImagesFromSelection(List, bool) Removes images from shown images.
ClearImagesFromSelection() Removes images from shown images.
GetSelectedImages(List) Outputs the selected image ids to the specified list. NOTE: List is not cleared internally.
GetFonts(List) Gets a list of available fonts
GetSprites(List) Gets a list of available sprites
GetScripts(List) Gets a list of available scripts
DrawFrame() Creates a new draw frame where you can add sprites to be rendered.
MeasureStringInPixels(StringBuilder, string, float) Calculates how many pixels a string of a given font and scale will take up.

Clone this wiki locally