Introduction The FlatRedBall.SpriteManager method will perform a “secondary” sort of all Sprites by their Texture. The first sort condition must be Z to preserve draw order. Sprites with the same Z value will then be sorted by Texture.


Introduction The RenderTargetRenderer class can be used to greatly increase the performance of FlatRedBall games which present complex scenes which never or rarely change. For static scenes a RenderTargetRenderer allows for near infinite complexity – specifically it allows for a very large number of visual elements to be drawn with almost no slowdown. Also, the[…]

Adding WPF to an Existing Game

Introduction WPF controls can be added to any FlatRedBall PC game. This walkthrough shows how to add a floating control which will both display runtime information and also be used to add new entity instances. Setup This tutorial uses a Glue project named “FrbAndWpf” as the starting point. This Glue project will contain the following:[…]


Introduction The ConvertToZBufferedSprite method can be used on Sprites which have already been added to the SpriteManager as ordered (not z-buffered). This method assumes: That the argument Sprite has already been added to the SpriteManager That the Sprite is not on a Layer Code Example The following code adds a Sprite regularly, then converts it[…]

Cleaning Up Screens

Introduction This error can occur if your current Screen is destroyed without cleaning up after itself. More specifically this means that objects were added to the FlatRedBall managers during the Screen’s life but were not removed prior to or during the Screen’s Destroy method. The error that you see will tell you which member to[…]


Introduction The Sprite’s Texture property controls which image the Sprite is displaying. This property is of type Texture2D. When a Sprite is created through the SpriteManager’s AddSprite method, the Sprite’s Texture property gets set inside that method. Code Example The following code explains how Textures are assigned. Files used: Add the following at class scope:[…]


Introduction Content managers provide functionality for organizing and caching game assets. They can be thought of as a “bucket of assets”. When you create an asset through the Content Manager, you give it a name (usually its file name) and decide which Content Manager it goes into. Later if the same name appears, the FlatRedBall[…]

01 – Introduction

Introduction Even if you’ve used FlatRedBall for a while you may not be familiar with exactly what a “manually updated” object is. The reason for this is because the option to make things manually updated exists almost exclusively for performance reasons. Technically one might want to manually update objects to achieve custom behavior as well,[…]

13. Destroying Entities

Introduction As mentioned in the conclusion of the previous tutorial the game currently has a severe accumulation bug (which some may refer to as a memory leak, although it’s not quite the same thing). This bug occurs because the game is continually creating new Entity instances, but is not destroying them. Rather than simply correcting[…]


Introduction Each Layer can have its own SortType which controls how Sprites, Text, and IDrawableBatches sort. This property allows each Layer to have its own Sort type. By default objects on Layers will be sorted by their Z values – objects with smaller Z values (which are in the distance) will draw behind objects which[…]