Skip to content

How can I execute raw draw commands? #6308

Answered by smoogipoo
SanicBTW asked this question in Q&A
Discussion options

You must be logged in to vote

The general idea is to create a DrawNode. The song and dance looks something like this:

public partial class MyDrawable : Drawable
{
    protected override DrawNode CreateDrawNode() => new MyDrawNode(this);
}

public class MyDrawNode : DrawNode
{
    public MyDrawNode(IDrawable source)
        : base(source)
    {
    }

    public override void ApplyState()
    {
        base.ApplyState();

        // Copy any states from the drawable locally here.
        // Typically, you'll need to cast Source to your drawable type somewhere to achieve this.
    }

    protected override void Draw(IRenderer renderer)
    {
        base.Draw(renderer);

        // Do your custom drawing here.
    }
}

F…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@SanicBTW
Comment options

Answer selected by SanicBTW
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants