Introduction The AddLayer method allows the addition of Camera-specific Layers. For more information on how Layers sort, see the Object Sorting wiki entry. Method Signatures AddLayer() instantiates a new Layer and adds it to the Camera’s internal list of Layers, at the end (to be drawn on top of all other contained Layers). AddLayer(Layer layerToAdd)[…]

FlatRedBallXna:Tutorials:Object Sorting

Introduction Many games require Sprites to overlap to create realistic scenes. FlatRedBall offers a number of ways to control sorting. This article will discuss and link to various methods of controlling how Sprites (and other objects) overlap. What are the methods? There are a number of methods of controlling overlapping Sprites. Keep in mind that[…]


Introduction The AddToManagers method adds all contained elements in the calling Scene to their appropriate managers. Since a Scene can contain Sprites, Text objects, and PositionedModels, this method can add objects to more than one manager. This method is most often called after a Scene is loaded through FlatRedBallServices. Method Signatures public void AddToManagers() Adds[…]


Introduction The Layer that newly-created particle Sprites should be added to. This is null by default. Code Example The following example adds an Emitter to a Layer. All emitted Sprites will appear behind the large, unlayered Sprite. Add the following using statements: using FlatRedBall.Content.Particle; using FlatRedBall.Graphics; Add the following at class scope: Emitter emitter; Add[…]


Tutorial See SpriteFrame Tutorial Creating a SpriteFrame in code The following code shows you how to create a SpriteFrame purely in code: Texture2D texture = FlatRedBallServices.Load<Texture2D>(“redball.bmp”, contentManager); SpriteFrame spriteFrame = SpriteManager.AddSpriteFrame(texture, SpriteFrame.BorderSides.All); SpriteFrames and Layers Just like Sprites and Text objects, SpriteFrames can be added to Layers. The following code creates two SpriteFrames. One is[…]


Introduction The TextManager is a static class which handles Text object addition, removal, and common behavior. The TextManager has many of the same methods (in concept) as the SpriteManager. 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[…]


Introduction Layers can be used to control the order of visual objects on screen. Typically objects with a larger Z value will appear behind objects with smaller Z values, but this relationship is only true if the objects are on the same layer. Layers take priority over the Z value of objects when performing rendering.[…]


Introduction The SpriteManager is a static class which handles Sprite addition, removal, and common behavior. The SpriteManager manages behavior for Sprites and SpriteFrames. Sprites The SpriteManager provides numerous methods for for working with Sprites. The following sections provide code samples for working with Sprite-related methods. Sprite Addition Most AddSprite methods both instantiate a new Sprite[…]


Introduction The Text object provides functionality for drawing bitmap fonts in 2D and 3D space. It inherits from the PositionedObject class and shares many similarities with the Sprite class. Just as the Sprite class is associated with the SpriteManager, the Text object is associated with the TextManager. Note that most games which use Text do[…]


Introduction The Camera encapsulates functionality to simplify and control the display of a FlatRedBall application to the user. The camera controls view position, rotation, and background color. If the Camera is 3D, it can also control, field of view, and viewable distance. By default the camera in FlatRedBall looks down the negative Z axis –[…]