void Hero::CreateTypeDescription() {
Hero h;
- TypeDescription &td(TypeDescription::CreateOrGet("Hero"));
-
- td.SetSize(sizeof(Hero));
int animationId(TypeDescription::GetTypeId("Animation"));
int numberId(TypeDescription::GetTypeId("Number"));
int statsId(TypeDescription::GetTypeId("Stats"));
int stringId(TypeDescription::GetTypeId("String"));
+ TypeDescription &td(TypeDescription::CreateOrGet("Hero"));
+ td.SetConstructor(&Construct);
+ td.SetSize(sizeof(Hero));
+
td.AddField("name", FieldDescription(((char *)&h.name) - ((char *)&h), stringId, true));
td.AddField("sprite", FieldDescription(((char *)&h.sprite) - ((char *)&h), spriteId, true));
td.AddField("level", FieldDescription(((char *)&h.level) - ((char *)&h), numberId, false));
td.AddField("meleeAnimation", FieldDescription(((char *)&h.meleeAnimation) - ((char *)&h), animationId, true));
}
+void Hero::Construct(void *data) {
+ new (data) Hero;
+}
+
}