So I’ve discovered an interesting situation with my current project, with the order that things are being rendered.
Currently, I’ve got something structured more or less the same as the Game State Management sample on the XNA Creators website. I started with something similar and canabalized it until I got it into the state that I wanted it. I’ve got it all wedged into a DrawableGameComponent in a separate library project. So, when I create a brand new XNA project, the plan is all that I have to do is add in the existing project, add in the DrawableGameComponent, and hit F5 to get stuff on the screen. That, and I really do like the idea of having everything in a separate class library.
Anyway, so just recently I discovered a different sort of an issue. In the main game drawing loop of the actual game, I’m drawing out some debug information. I discovered that when I started drawing some 3D content from one of the GameScreens it was drawing over top of the debug information that was being drawn. I checked the main draw call in the game class, and the only thing that it was drawing was the debug text. Everything else was being drawn by the DrawableGameComponent. This means that I don’t entirely have control of when things are drawn, unless they too are being drawn from DrawableGameComponents. I know there is a field on the DrawableGameComponent to control the draw order, but this only seems to affect the order of DrawableGameComponents being drawn in relation to each other.
So, I suppose there really is only one way that I can think of to solve this problem: put my debug drawing code inside a DrawableGameComponent. This is a bit of a pain in the butt, but probably the best alternative in the long run anyway, especially once I start adding other bits for scripting and a proper console.
Update: So it turns out there is a fairly straightforward solution to this problem. What happens in the DrawableGameComponents are drawn when the call is made to base.Draw() in the main rendering loop of the game. So, if you want your DrawableGameComponents to be drawn before the other stuff that you are drawing in the main rendering loop, clear your screen, then call base.Draw(), then render whatever it is you are rendering (in my case, some debug information).