I have a game with two components terrain and fpscounter. Without ordering, fpscounter may draw first then be overwritten by terrain. or If you use zbuffering fps appears but if your font has transparency to smooth the edges it looks all ugly, so ordering is important.
I had to comment out DrawCommponents and call each components.Draw manually in the order i wanted. Some simple integer zorder property on the components could work though.
Sorting could occur only when opponents are added or removed and the game could subscribe to a ZorderChanged event for each of it's child components?
Similar suggestions ahve been made in connect
See (you must be logged into connect before the links will work)
https://connect.microsoft.com/feedback/ViewFeedback.aspx?FeedbackID=195718&SiteID=226
and more like it
https://connect.microsoft.com/feedback/SearchResults.aspx?SearchQuery=gamecomponent+&SiteID=226
Please search connect to see if your suggestions have already been made
T-MeK wrote:
[...] I had to comment out DrawCommponents and call each components.Draw
manually in the order i wanted. Some simple integer zorder property on
the components could work though. [...]
Is there a reason you commented out the DrawComponents call instead of simply overriding it altogether?
MY TEST
the Update order cannot be controlled but orde of drawing can be controlled is very easy !!
private GrapM _grapm;....Texture information...bla...bla
load resoruces ..and draw....... use five SpriteBhach.Draw overload of the method
_grapm.spritebatch.Draw(Texture,
new Vector2(_X, _Y), null, Color.White, 0f, new Vector2(0, 0), 0f, SpriteEffects.None,_Order);
GrapM and a component that is in charge of the Device and the Spritebach..
public
partial class GrapM : Microsoft.Xna.Framework.GameComponent{
Conclusions: