justin-espedal / polydes

Collection of open source Stencyl extensions.
MIT License
8 stars 4 forks source link

More standard types: Insets and Dimension #75

Closed justin-espedal closed 9 years ago

justin-espedal commented 9 years ago

Writing a system to make it easy to include different types. Here's an example with the dialog extension's "Animation" class.

class Animation
{
    public var actor:ActorType;
    public var anim:String;

    public function new(type:ActorType, anim:String)
    {
        this.actor = type;
        this.anim = anim;
    }
}

This class (dialog.core.Animation) is selected, and the constructor arguments are used to generate an xml file.

<type class="dialog.core.Animation">
    <fields>
        <field name="type" type="com.stencyl.models.actor.ActorType" />
        <field name="anim" type="String" />
    </fields>
</type>

This is what it looks like in the UI:

animation

Finally, the generated code is equivalent to this:

pointerAnim = new dialog.core.Animation(_SomeActorTypeName, "Animation 0");

justin-espedal commented 9 years ago

The labels don't really work being inline with the fields when you have long labels, so I moved them out of the way. Now the label on the left is out of alignment, but I guess I can live with that for now.

animation2

justin-espedal commented 9 years ago

New types:

screenshot 2015-10-17 18 32 14

They work with the extra "Default" field too, no extra work.

screenshot 2015-10-17 18 33 21

justin-espedal commented 9 years ago

Done. bbccd7fba765a8d852c75f9724274fae604ca1e7