namespace graphics {
-void Animation::AddFields(TypeDescription &td, const Animation &a, std::ptrdiff_t offset) {
- int boolId(TypeDescription::GetTypeId("Boolean"));
- int numberId(TypeDescription::GetTypeId("Number"));
- int spriteId(TypeDescription::GetTypeId("Sprite"));
-
+void Animation::AddFields(TypeDescription &td, const Animation &a, std::ptrdiff_t offset, int boolId, int numberId, int spriteId) {
td.AddField("sprite", FieldDescription(((char *)&a.sprite) - ((char *)&a) - offset, spriteId, true));
td.AddField("frametime", FieldDescription(((char *)&a.frameTime) - ((char *)&a) - offset, numberId, false));
td.AddField("repeat", FieldDescription(((char *)&a.repeat) - ((char *)&a) - offset, boolId, false));
virtual geometry::Vector<int> Offset(int frame) const { return geometry::Vector<int>(); }
protected:
- static void AddFields(loader::TypeDescription &, const Animation &, std::ptrdiff_t offset);
+ static void AddFields(loader::TypeDescription &, const Animation &, std::ptrdiff_t offset, int boolId, int numberId, int spriteId);
private:
const Sprite *sprite;
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"));
TypeDescription &td(TypeDescription::CreateOrGet("ComplexAnimation"));
td.SetSize(sizeof(ComplexAnimation));
td.AddSupertype(animationId, ((char *)a) - ((char *)&ca));
- Animation::AddFields(td, ca, ((char *)a) - ((char *)&ca));
+ Animation::AddFields(td, ca, ((char *)a) - ((char *)&ca), boolId, numberId, spriteId);
td.AddField("frames", FieldDescription(((char *)&ca.frames) - ((char *)&ca), frameId, true, true));
Animation *a(&sa);
int animationId(TypeDescription::GetTypeId("Animation"));
+ int boolId(TypeDescription::GetTypeId("Boolean"));
int numberId(TypeDescription::GetTypeId("Number"));
+ int spriteId(TypeDescription::GetTypeId("Sprite"));
TypeDescription &td(TypeDescription::CreateOrGet("SimpleAnimation"));
td.SetSize(sizeof(SimpleAnimation));
td.AddSupertype(animationId, ((char *)a) - ((char *)&sa));
+ Animation::AddFields(td, sa, ((char *)a) - ((char *)&sa), boolId, numberId, spriteId);
td.AddField("framecount", FieldDescription(((char *)&sa.numFrames) - ((char *)&sa), numberId, false));
td.AddField("col", FieldDescription(((char *)&sa.col) - ((char *)&sa), numberId, false));
td.AddField("row", FieldDescription(((char *)&sa.row) - ((char *)&sa), numberId, false));