X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FComplexAnimation.cpp;h=c828e4ccb102e662745bedeeabd43efcb649855a;hb=978ccdf2644bc445c864dbe581ead365b238cff8;hp=e4d293cdd920297799adda7225ad5fe59e21e5e5;hpb=46d158b25b842d2ec4b9734af09ca6006c934498;p=l2e.git diff --git a/src/graphics/ComplexAnimation.cpp b/src/graphics/ComplexAnimation.cpp index e4d293c..c828e4c 100644 --- a/src/graphics/ComplexAnimation.cpp +++ b/src/graphics/ComplexAnimation.cpp @@ -19,26 +19,35 @@ void ComplexAnimation::CreateTypeDescription() { Animation *a(&ca); int animationId(TypeDescription::GetTypeId("Animation")); + int boolId(TypeDescription::GetTypeId("Boolean")); int frameId(TypeDescription::GetTypeId("ComplexAnimationFrame")); + int numberId(TypeDescription::GetTypeId("Number")); + int spriteId(TypeDescription::GetTypeId("Sprite")); + int vectorId(TypeDescription::GetTypeId("Vector")); TypeDescription &td(TypeDescription::CreateOrGet("ComplexAnimation")); + td.SetDescription("Complex animation type that supports per-frame disposition and non-linear sprite offset selection."); + td.SetConstructor(&Construct); td.SetSize(sizeof(ComplexAnimation)); td.AddSupertype(animationId, ((char *)a) - ((char *)&ca)); - td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), frameId, true, true)); + Animation::AddFields(td, ca, ((char *)a) - ((char *)&ca), boolId, numberId, spriteId); + td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), frameId).SetReferenced().SetAggregate().SetDescription("a variable number of frames")); FrameProp fp; - int numberId(TypeDescription::GetTypeId("Number")); - int vectorId(TypeDescription::GetTypeId("Vector")); - TypeDescription &ftd(TypeDescription::CreateOrGet("ComplexAnimationFrame")); + ftd.SetDescription("Information about how a frame of a complex animation should be rendered."); ftd.SetSize(sizeof(FrameProp)); - ftd.AddField("column", FieldDescription(((char *)&fp.col) - ((char *)&fp), numberId, false)); - ftd.AddField("row", FieldDescription(((char *)&fp.row) - ((char *)&fp), numberId, false)); - ftd.AddField("disposition", FieldDescription(((char *)&fp.disposition) - ((char *)&fp), vectorId, false)); + ftd.AddField("column", FieldDescription(((char *)&fp.col) - ((char *)&fp), numberId).SetDescription("the column of the sprite that will be drawn")); + ftd.AddField("row", FieldDescription(((char *)&fp.row) - ((char *)&fp), numberId).SetDescription("the row of the sprite that will be drawn")); + ftd.AddField("disposition", FieldDescription(((char *)&fp.disposition) - ((char *)&fp), vectorId).SetDescription("offset from the original drawing position")); +} + +void ComplexAnimation::Construct(void *data) { + new (data) ComplexAnimation; } }