# Draw order in XNA

It is possible to set draw order of a DrawableGameComponent by setting DrawOrder property. But is it possible to set draw order of "main" Game class?

I have 2 DrawableGameComponents, and Draw method of a main Game class is called first, while I want it to be the last. Should I just mode all "main" draw code to another component and set it DrawOrder?

• Yes you should :) – Roy T. Mar 30 '12 at 8:55
• @RoyT. seems like I'm just confused myself a little. Black on black, that's why I didn't saw it. Main Draw is called last, as expected. I'll remove question soon. – Petr Abdulin Mar 30 '12 at 9:19

I wanted to clarify: Inside MyGame.Draw there is usually a call to base.Draw. It is my impression that this line is responsible for drawing attached components. Whatever code you put above it will be drawn before, whatever you put below it will be drawn after. If you remove the call to base, presumably the components will not be drawn.
If you have components A, B and C, and you would like MyGame.Draw to draw A and B, then draw some of its own stuff, and then draw C, it seems you'd have to draw each component manually by iterating through MyGame.Components.