Introduction   The SpriteList class was at one time the preferred class for storing a dynamic list of Sprites. New code should use the PositionedObjectList class, specifically PositionedObjectList<Sprite>.


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 Sprite is a flat graphical object which is commonly used in 2D games as well as for particles, HUDs, and UIs in 3D games. The Sprite class inherits from the PositionedObject class. Tutorials Working with Sprites Sprite Scale For information on Scale, see the IScalable wiki entry. To match the on-screen pixel dimensions[…]


Introduction ConvertToAutomaticallyUpdated can be used to convert an object back to an automatically updated object. This is useful for objects which typically do not move (so they shouldn’t be automatically updated), but which may move from time to time. ConvertToAutomaticallyUpdated can be called on Sprites and PositionedObject. Code Example The following shows how an entity[…]


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 is a class which 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[…]


Introduction The Alpha value controls the opacity of a Sprite. A value of 1 (default) results in a fully-opaque Sprite, while a value of 0 is a fully-transparent Sprite. For more information see the Alpha property on IColorable. Sprite Alpha can be also be set in Glue directly and through states. Sprites can also be[…]

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 IVisible interface is an interface which defines that an object must have a Visible property. Setting Visible to true or false will make the object appear or disappear visually. Most visual FlatRedBall types implement the IVisible property including: Sprite Text AxisAlignedRectangle Circle Polygon SpriteFrame Code Example The following code shows how to toggle[…]


Introduction The TextureScale property can be used to size a Sprite according to its Texture and texture coordiantes. If a Sprite which is displaying its full texture is using a TextureScale of 1, then the Sprite’s width will match its Texture’s width, and the Sprite’s height will match the Texture’s Height. A TextureScale of 1[…]