X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FGauge.cpp;h=b7023d40538b68075a0085ccd111201bca95f44e;hb=9f352d64f920f46a2d5b4fe67408154629933293;hp=7407ba77c2f087f57b69a8af84f51a0f1cde4d9c;hpb=63e55846d4043f96ee1bdb95f0631b07d5f57c28;p=l2e.git diff --git a/src/graphics/Gauge.cpp b/src/graphics/Gauge.cpp index 7407ba7..b7023d4 100644 --- a/src/graphics/Gauge.cpp +++ b/src/graphics/Gauge.cpp @@ -85,14 +85,15 @@ void Gauge::Draw(SDL_Surface *dest, const Vector &position, int width, Uint void Gauge::CreateTypeDescription() { Gauge g; - TypeDescription &td(TypeDescription::CreateOrGet("Gauge")); - - td.SetSize(sizeof(Gauge)); int imageId(TypeDescription::GetTypeId("Image")); int numberId(TypeDescription::GetTypeId("Number")); int vectorId(TypeDescription::GetTypeId("Vector")); + TypeDescription &td(TypeDescription::CreateOrGet("Gauge")); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Gauge)); + td.AddField("image", FieldDescription(((char *)&g.surface) - ((char *)&g), imageId, true)); td.AddField("full", FieldDescription(((char *)&g.fullOffset) - ((char *)&g), vectorId, false)); td.AddField("empty", FieldDescription(((char *)&g.emptyOffset) - ((char *)&g), vectorId, false)); @@ -102,4 +103,8 @@ void Gauge::CreateTypeDescription() { td.AddField("end", FieldDescription(((char *)&g.endWidth) - ((char *)&g), numberId, false)); } +void Gauge::Construct(void *data) { + new (data) Gauge; +} + }