X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FGauge.cpp;h=d0e891a74b56e345d8d065141bacc8d731ba11c8;hb=3f8fac16c7ae2cbe7da47b98aba9b558825723e7;hp=7407ba77c2f087f57b69a8af84f51a0f1cde4d9c;hpb=63e55846d4043f96ee1bdb95f0631b07d5f57c28;p=l2e.git diff --git a/src/graphics/Gauge.cpp b/src/graphics/Gauge.cpp index 7407ba7..d0e891a 100644 --- a/src/graphics/Gauge.cpp +++ b/src/graphics/Gauge.cpp @@ -85,21 +85,30 @@ 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")); - 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)); - td.AddField("height", FieldDescription(((char *)&g.height) - ((char *)&g), numberId, false)); - td.AddField("start", FieldDescription(((char *)&g.startWidth) - ((char *)&g), numberId, false)); - td.AddField("repeat", FieldDescription(((char *)&g.repeatWidth) - ((char *)&g), numberId, false)); - td.AddField("end", FieldDescription(((char *)&g.endWidth) - ((char *)&g), numberId, false)); + TypeDescription &td(TypeDescription::CreateOrGet("Gauge")); + td.SetDescription( + "Gauges display a percentage by filling the left part different than the right.\n" + "The fill level is only mapped with repeat.\n" + "Start is filled if the level in greater than zero, end is filled if the level is at its maximum."); + td.SetConstructor(&Construct); + td.SetSize(sizeof(Gauge)); + + td.AddField("image", FieldDescription(((char *)&g.surface) - ((char *)&g), imageId).SetReferenced().SetDescription("the underlying graphic from which the gauge parts are cut")); + td.AddField("full", FieldDescription(((char *)&g.fullOffset) - ((char *)&g), vectorId).SetDescription("top-left corner of the filled gauge")); + td.AddField("empty", FieldDescription(((char *)&g.emptyOffset) - ((char *)&g), vectorId).SetDescription("top-left corner of the empty gauge")); + td.AddField("height", FieldDescription(((char *)&g.height) - ((char *)&g), numberId).SetDescription("height of the gauges")); + td.AddField("start", FieldDescription(((char *)&g.startWidth) - ((char *)&g), numberId).SetDescription("width of the start part")); + td.AddField("repeat", FieldDescription(((char *)&g.repeatWidth) - ((char *)&g), numberId).SetDescription("width of the repeat part")); + td.AddField("end", FieldDescription(((char *)&g.endWidth) - ((char *)&g), numberId).SetDescription("width of the end part")); +} + +void Gauge::Construct(void *data) { + new (data) Gauge; } }