From: Daniel Karbach Date: Sun, 9 Sep 2012 12:14:13 +0000 (+0200) Subject: added type description of MenuProperties X-Git-Url: http://git.localhorst.tv/?a=commitdiff_plain;h=e35b71bedb8c2424346d60c737020f1599438b74;p=l2e.git added type description of MenuProperties --- diff --git a/src/graphics/Menu.cpp b/src/graphics/Menu.cpp new file mode 100644 index 0000000..b70697e --- /dev/null +++ b/src/graphics/Menu.cpp @@ -0,0 +1,43 @@ +/* + * Menu.cpp + * + * Created on: Sep 9, 2012 + * Author: holy + */ + +#include "Menu.h" + +#include "../loader/TypeDescription.h" + +using loader::FieldDescription; +using loader::TypeDescription; + +namespace graphics { + +void MenuProperties::CreateTypeDescription() { + MenuProperties p; + TypeDescription &td(TypeDescription::CreateOrGet("MenuProperties")); + + td.SetSize(sizeof(MenuProperties)); + + int fontId(TypeDescription::GetTypeId("Font")); + int numberId(TypeDescription::GetTypeId("Number")); + int spriteId(TypeDescription::GetTypeId("Sprite")); + int stringId(TypeDescription::GetTypeId("String")); + + td.AddField("font", FieldDescription(((char *)&p.font) - ((char *)&p), fontId, true)); + td.AddField("disabledFont", FieldDescription(((char *)&p.disabledFont) - ((char *)&p), fontId, true)); + td.AddField("cursor", FieldDescription(((char *)&p.cursor) - ((char *)&p), spriteId, true)); + td.AddField("charsPerEntry", FieldDescription(((char *)&p.charsPerEntry) - ((char *)&p), numberId, false)); + td.AddField("rows", FieldDescription(((char *)&p.rows) - ((char *)&p), numberId, false)); + td.AddField("rowGap", FieldDescription(((char *)&p.rowGap) - ((char *)&p), numberId, false)); + td.AddField("iconSpace", FieldDescription(((char *)&p.iconSpace) - ((char *)&p), numberId, false)); + td.AddField("cols", FieldDescription(((char *)&p.cols) - ((char *)&p), numberId, false)); + td.AddField("colGap", FieldDescription(((char *)&p.colGap) - ((char *)&p), numberId, false)); + td.AddField("delimiter", FieldDescription(((char *)&p.delimiter) - ((char *)&p), stringId, false)); + td.AddField("charsPerNumber", FieldDescription(((char *)&p.charsPerNumber) - ((char *)&p), numberId, false)); + td.AddField("charsPerAdditionalText", FieldDescription(((char *)&p.charsPerAdditionalText) - ((char *)&p), numberId, false)); + td.AddField("additionalTextGap", FieldDescription(((char *)&p.additionalTextGap) - ((char *)&p), numberId, false)); +} + +} diff --git a/src/graphics/Menu.h b/src/graphics/Menu.h index 175a711..7aa2e94 100644 --- a/src/graphics/Menu.h +++ b/src/graphics/Menu.h @@ -43,6 +43,8 @@ struct MenuProperties { MenuProperties(const Font *font, const Font *disabledFont, const Sprite *cursor, int charsPerEntry, int rows, int rowGap, int iconSpace, int cols, int colGap, int charsPerNumber, char delimiter, int charsPerAdditionalText, int additionalTextGap) : font(font), disabledFont(disabledFont), cursor(cursor), charsPerEntry(charsPerEntry), rows(rows), rowGap(rowGap), iconSpace(iconSpace), cols(cols), colGap(colGap), charsPerNumber(charsPerNumber), charsPerAdditionalText(charsPerAdditionalText), additionalTextGap(additionalTextGap), delimiter(delimiter) { } + + static void CreateTypeDescription(); }; template