githubEdit

TextManager

Introduction

The TextManager is a static class which handles Textarrow-up-right object addition, removal, and common behavior. The TextManager has many of the same methods (in concept) as the SpriteManagerarrow-up-right. The TextManager is automatically instantiated by FlatRedBall so you do not need to create an instance yourself.

Text Object

The TextManager provides numerous methods for for working with the Textarrow-up-right object. The following sections provide code samples for working with Textarrow-up-right-related methods.

Text Addition

Most AddText methods both instantiate a new Textarrow-up-right object as well as add it to TextManager for management. The following methods instantiate and add a Textarrow-up-right object to the SpriteManager:

Text text = TextManager.AddText("FlatRedBall Rocks!"); // uses default font

Custom BitmapFontsarrow-up-right can be used when creating Textarrow-up-right objects as well.

BitmapFont bitmapFont = new BitmapFont("textureFile.png", "fontFile.txt", "content manager name");
Text text = TextManager.AddText("Text with custom font", bitmapFont);

For information see the BitmapFont wiki entryarrow-up-right.

Adding Text and Layers

Textarrow-up-right objects can also be added to Layersarrow-up-right.

 // Layers must be created through the SpriteManager
 Layer layer = SpriteManager.AddLayer();

 Text text = TextManager.AddText("I'm on a layer.", layer);

For more information, see the Layer wiki entryarrow-up-right and the AddToLayer methodarrow-up-right.

Text Removal

The RemoveText methods remove Textarrow-up-right objects from the engine as well as any two-wayarrow-up-right AttachableListsarrow-up-right (such as PositionedObjectListarrow-up-right) that the Textarrow-up-right object belong to. For more information, see the RemoveText pagearrow-up-right.

TextManager Members

[subpages depth="1"]

Last updated

Was this helpful?