githubEdit

ShapeDrawingOrder

Introduction

The ShapeDrawingOrder controls whether all Shapes are drawn under or over other FlatRedBall-drawn objects (for example Spritesarrow-up-right, Modelsarrow-up-right, and Textsarrow-up-right). 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 Spritearrow-up-right and a Linearrow-up-right, then sets ShapeDrawingOrder to UnderEverything so that the added Linearrow-up-right appears under the Spritearrow-up-right.

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

Last updated

Was this helpful?