Introduction The AddText method is used to either add an existing Text instance to the engine, or to both create and add a Text to the engine. Code Example The following code adds a Text object to the engine. Text text object will be automatically visible and updated by the engine. Text textInstance = TextManager.AddText("Hello");


Introduction The RemoveText method will remove the argument Text instance from the engine so it will no longer be drawn or have every-frame management applied. RemoveText also removes the Text from any PositionedObjectList that it is a part of (assuming a two-way relationship). Code Example // Assuming text is a valid Text which has been[…]


Introduction The AdjustPositionForPixelPerfectDrawing method tells the FlatRedBall Engine to attempt to offset Text objects so that they do not render in-between pixels. This value defaults to true, and in most cases you do not need to adjust it. When to adjust AdjustPositionForPixelPerfectDrawing AdjustPositionForPixelPerfectDrawing should be turned off if FlatRedBall is not properly adjusting your Text[…]


Introduction The GetWidth method returns the width of a piece of text. The GetWidth method returns the width of text, and can accept a variety of arguments. The overloads provide flexibility depending on how much information is needed. Overloads public static float GetWidth(string text) public static float GetWidth(string text, float spacing) public static float GetWidth(string[…]


Introduction ApplyColorOperation is a method which can be used to modify an ImageData using the same ColorOperation and Red,Green,Blue values that are present in the IColorable interface which is implemented by common FlatRedball objects such as Sprite and Text. ApplyColorOperation modifies the data stored in an ImageData permanently – it cannot be undone. Code Example[…]


Introduction The MaxWidth value controls the available area that the Text object can render text inside. The Text object will either wrap or clamp text according to its MaxWidthBehavior. Code Example Text text = TextManager.AddText(""); text.DisplayText = "Hello, I am some really long text that will wrap"; text.MaxWidth = 60; text.MaxWidthBehavior = MaxWidthBehavior.Wrap;


Introduction The FilterTexts property controls whether Texts are rendered. The TextManager can set this value and it will override the value set in the GraphicsOption’s TextureFilter property. Default Value The default for TextManager.FilterTexts is false, while the default value for the GraphicsOption’s TextureFilter is on (technically it’s an enumeration, but for simplicity we’ll say that[…]


Introduction The DisplayText property controls what a Text object will write to the Screen. The DisplayText property can be set to initially set what the Text will display, and it can be changed at any time. The DisplayText property should be used to change a Text’s display instead of re-creating a new Text every frame[…]


Code Example The following code creates a Text object and adds it to a layer. Layer layer = SpriteManager.AddLayer(); Text text = TextManager.AddText(“Hello”, layer); Alternatively the Text can be added to a Layer after AddText is called. The following code can also be used: Layer layer = SpriteManager.AddLayer(); Text text = TextManager.AddText(“Hello”); TextManager.AddToLayer(text, layer);


Introduction HorizontalAlignment determines how the text aligns itself according to the Text’s X position. By default text is left justified, so the left side of the first letter will be placed at the Text’s X value. Code Example The Text object’s X value marks the left side of the text object by default – that[…]