This project is read-only.


May 24, 2009 at 7:47 AM


How can I access to drawable childs of DrawTarget?


May 24, 2009 at 8:11 AM

There isn't any standard way. However you can always simply create an intermediate class (which will be common behavior anyway, if you want to be drawing things in a dynamic order then it's best to be handled in a separate class, etc).

May 24, 2009 at 9:51 AM

Can you add some readonly methods to define how much childs it have, and get child by index?


May 24, 2009 at 11:38 AM
Edited Oct 6, 2009 at 9:39 AM

I don't plan to do that.

There is nothing stopping you making a class something like:

class DrawList : IDraw
  IDraw[] items;
  public void Draw(DrawState state)
    foreach (IDraw item in items)
      if (item.CullTest(state))

  bool ICullable.CullTest(ICuller state)
    return true;

And adding an instance of that to the DrawTarget, then doing what you need in that class instead.


May 24, 2009 at 3:42 PM


Thanks for your help!

Oct 6, 2009 at 5:48 AM

I wrote a method:

public static List<IDraw> GetXenDrawTargetDrawList(DrawTarget target)
   Type targetType = target.GetType().BaseType;
    return (List<IDraw>)targetType.GetField("drawList", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(target);

Can you add only ClearAllChildrens method? This is all that is needed.


Oct 6, 2009 at 9:38 AM
Edited Oct 6, 2009 at 9:42 AM

I wouldn't recommend doing this.

The best (and intended) way to deal with this situation is to use your own intermediate class. If you want to have very direct control of draw order, then it's best to implement that control yourself in a wrapper class. Very similar to what I posted just up above. That way you have complete control of the draw order and store your list however you want.