Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Sandbox.ModAPI.Ingame.IMyTextSurface

Malware edited this page May 13, 2024 · 28 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:

Type Definitions:

  • MyObjectBuilder_TextPanel/HoloLCDLarge
  • MyObjectBuilder_TextPanel/HoloLCDSmall
  • MyObjectBuilder_TextPanel/LargeBlockCorner_LCD_1
  • MyObjectBuilder_TextPanel/LargeBlockCorner_LCD_2
  • MyObjectBuilder_TextPanel/LargeBlockCorner_LCD_Flat_1
  • MyObjectBuilder_TextPanel/LargeBlockCorner_LCD_Flat_2
  • MyObjectBuilder_TextPanel/LargeCurvedLCDPanel
  • MyObjectBuilder_TextPanel/LargeDiagonalLCDPanel
  • MyObjectBuilder_TextPanel/LargeFullBlockLCDPanel
  • MyObjectBuilder_TextPanel/LargeLCDPanel
  • MyObjectBuilder_TextPanel/LargeLCDPanel3x3
  • MyObjectBuilder_TextPanel/LargeLCDPanel5x3
  • MyObjectBuilder_TextPanel/LargeLCDPanel5x5
  • MyObjectBuilder_TextPanel/LargeLCDPanelWide
  • MyObjectBuilder_TextPanel/LargeTextPanel
  • MyObjectBuilder_TextPanel/SmallBlockConsoleModuleScreens
  • MyObjectBuilder_TextPanel/SmallBlockCorner_LCD_1
  • MyObjectBuilder_TextPanel/SmallBlockCorner_LCD_2
  • MyObjectBuilder_TextPanel/SmallBlockCorner_LCD_Flat_1
  • MyObjectBuilder_TextPanel/SmallBlockCorner_LCD_Flat_2
  • MyObjectBuilder_TextPanel/SmallCurvedLCDPanel
  • MyObjectBuilder_TextPanel/SmallDiagonalLCDPanel
  • MyObjectBuilder_TextPanel/SmallFullBlockLCDPanel
  • MyObjectBuilder_TextPanel/SmallLCDPanel
  • MyObjectBuilder_TextPanel/SmallLCDPanelWide
  • MyObjectBuilder_TextPanel/SmallTextPanel
  • MyObjectBuilder_TextPanel/TransparentLCDLarge
  • MyObjectBuilder_TextPanel/TransparentLCDSmall

Properties

TextAlignment Alignment { get; set; }

How should the text be aligned

byte BackgroundAlpha { get; set; }

Value for offscreen texture alpha channel - for PBR material it is metalness (should be 0) - for transparent texture it is opacity

Color BackgroundColor { get; set; }

Gets or sets background color

float ChangeInterval { get; set; }

Gets or sets the change interval for selected textures

ContentType ContentType { get; set; }

Type of content to be displayed on the screen.

string 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.

string DisplayName { get; }

Get localized name of this surface.

string Font { get; set; }

Gets or sets the font

Color FontColor { get; set; }

Gets or sets font color

float FontSize { get; set; }

Gets or sets font size

string Name { get; }

Gets identifier name of this surface.

bool PreserveAspectRatio { get; set; }

Gets or sets preserve aspect ratio of images.

string Script { get; set; }

Currently running script

Color ScriptBackgroundColor { get; set; }

Gets or sets background color used for scripts.

Color ScriptForegroundColor { get; set; }

Gets or sets foreground color used for scripts.

Vector2 SurfaceSize { get; }

Gets size of the drawing surface.

float TextPadding { get; set; }

Gets or sets text padding from all sides of the panel.

Vector2 TextureSize { get; }

Gets size of the texture the drawing surface is rendered to.

Methods

void AddImagesToSelection(List<string> ids, bool checkExistence = default)

Adds image to list of shown images. You can get image ids by GetSelectedImages(List)

void AddImageToSelection(string id, bool checkExistence = default)

Adds image to list of shown images. You can get image ids by GetSelectedImages(List)

void ClearImagesFromSelection()

Removes images from shown images.

MySpriteDrawFrame DrawFrame()

Creates a new draw frame where you can add sprites to be rendered.

void GetFonts(List<string> fonts)

Gets a list of available fonts

void GetScripts(List<string> scripts)

Gets a list of available scripts

void GetSelectedImages(List<string> output)

Outputs the selected image ids to the specified list. NOTE: List is not cleared internally.

void GetSprites(List<string> sprites)

Gets a list of available sprites

string GetText()

Gets current text that is written on surface. Allocates memory (StringBuilder.ToString())! This method doesn't allocate memory ReadText(StringBuilder, bool = default)

Vector2 MeasureStringInPixels(StringBuilder text, string font, float scale)

Calculates how many pixels a string of a given font and scale will take up.

void ReadText(StringBuilder buffer, bool append = default)

Gets current text that is written on surface.

void RemoveImageFromSelection(string id, bool removeDuplicates = default)

Removes image from shown images.

void RemoveImagesFromSelection(List<string> ids, bool removeDuplicates = default)

Removes images from shown images.

bool WriteText(string value, bool append = default)

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

bool WriteText(StringBuilder value, bool append = default)

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

Clone this wiki locally