1
2
3
4
5
6
7
8
9
10
11
12
13
public void Draw(SpriteBatch spriteBatch, Matrix? parentTransform = null)
{
	Matrix globalTransform = localTransform;
	if(parentTransform != null) globalTransform *= parentTransform.Value;
	
	// Decompose matrix and draw this display object here
	DecomposeMatrix(globalTransform);
	spriteBatch.Draw(...);
	
	// Draw children
	foreach(var child in Children)
		child.Draw(spriteBatch, globalTransform);
}