Introduction The SortXInsertionAscending (and SortYInsertionAscending/SortZInsertionAscending) function can be used to sort all contained PositionedObjects in a list by their X (or Y/Z) value. Code Example The following code creates 3 Circles and places them in a PositionedObjectList in descending X order. Then SortXInsertionAscending is called, and the positions of the Circles are printed out: FlatRedBall.Math.PositionedObjectList<Circle>[…]


Introduction The Clear function is a function that will empty a PositionedObjectList of all contained references – it operates the same way as calling Clear on a normal List. However, although Clear is a very common function when dealing with regular Lists, it is not often used on PositionedObjectLists. If you are using Clear, make[…]


Introduction The Add method adds the argument PositionedObject to the PositionedObjectList. The argument object will create a two-way relationship with the list. Null arguments are not allowed.


Introduction The GetFirstAfter value can be used to get the index of the next object after a given position value. For example, if you are working with a group of Circles and are implementing some spacial partitioning logic, you can use GetFirstAfter to find the index of the first Circle in a list to begin[…]


Introduction GetFirstAfterPosition is obsolete. The upper bound for GetFirstAfterPosition is inclusive. GetFirstAfter uses an exclusive upper bound to match other range-accepting methods in C#. Please use FlatRedBall.Math.PositionedObjectList.GetFirstAfter.


Introduction The AttachTo method is a shortcut method for attaching all contained elements in the list to the argument. The method’s contents are as follows: public void AttachTo(PositionedObject newParent, bool changeRelative) { for (int i = 0; i < Count; i++) { this[i].AttachTo(newParent, changeRelative); } } For more information on the AttachTo method, see the[…]


Introduction The RemoveSpriteOneWay method removes the argument Sprite from the SpriteManager (for both rendering and automatic updates) but does not modify any relationships between the Sprite and objects outside of the game engine. Specifically, RemoveSpriteOneWay will remove a Sprite from: Rendering Ordered rendering Z-Buffered rendering Layered rendering Automatic engine updates RemoveSpriteOneWay will not remove a[…]

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 AxisAlignedRectangles property is a property of type PositionedObjectList. Therefore, you can use this member the same way you would use a PositionedObjectList<AxisAlignedRectangle>. Code Example The following shows how to loop through all rectangles in a ShapeCollection and perform collision between the rectangles and a Circle named CircleInstance: for(int i = 0; i <[…]


Introduction The RemoveText method will remove the argument Text instance from the engine so it will no longer be drawn or have every-frame management applied. RemoveText also removes the Text from any PositionedObjectList that it is a part of (assuming a two-way relationship). Code Example // Assuming text is a valid Text which has been[…]