FlatRedBall.Math.Geometry.ShapeManager.ShapeDrawingOrder

Introduction

The ShapeDrawingOrder controls whether all Shapes are drawn under or over other FlatRedBall-drawn objects (for example Sprites, Models, and Texts). Currently shape drawing order cannot be controlled by the shape’s Z value; however, as of the June 2009 release of FlatRedBall, most shapes can be placed on layers which provides some control over ordering.

The ShapeDrawingOrder has two options:

  • UnderEverything
  • OverEverything (default)

Since the default for the ShapeManager’s ShapeDrawingOrder is OverEverything, then all shape drawing will appear on top of other objects.

Code Example

The following example adds a Sprite and a Line, then sets ShapeDrawingOrder to UnderEverything so that the added Line appears under the Sprite.

Add the following using statements:

using FlatRedBall;
using FlatRedBall.Math.Geometry;

Add the following to Initialize after initializing FlatRedBall:

 SpriteManager.AddSprite("redball.bmp");

 Line line = ShapeManager.AddLine();
 line.SetFromAbsoluteEndpoints(new Vector3(-3, 0, 0), new Vector3(3, 0, 0));

 ShapeManager.ShapeDrawingOrder = ShapeDrawingOrder.UnderEverything;

ShapeDrawingOrder.png