X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FMenu.cpp;h=1b81f85a2d731ec7e88c4ed4a1be4926f8f8a0d9;hb=67f6bb1d9727e7d1e2140cf2913aa89ebba84bf5;hp=113e4151b826f8fa0e1a289ead12388ce6a4f2ee;hpb=4bc70f5311dcbcca4e6b9e852bbcb19602f50eeb;p=l2e.git diff --git a/src/graphics/Menu.cpp b/src/graphics/Menu.cpp index 113e415..1b81f85 100644 --- a/src/graphics/Menu.cpp +++ b/src/graphics/Menu.cpp @@ -1,15 +1,10 @@ -/* - * Menu.cpp - * - * Created on: Sep 9, 2012 - * Author: holy - */ - #include "Menu.h" +#include "../loader/Interpreter.h" #include "../loader/TypeDescription.h" using loader::FieldDescription; +using loader::Interpreter; using loader::TypeDescription; namespace graphics { @@ -17,28 +12,27 @@ namespace graphics { void MenuProperties::CreateTypeDescription() { MenuProperties p; - int fontId(TypeDescription::GetTypeId("Font")); - int numberId(TypeDescription::GetTypeId("Number")); - int spriteId(TypeDescription::GetTypeId("Sprite")); - int stringId(TypeDescription::GetTypeId("String")); - - TypeDescription &td(TypeDescription::CreateOrGet("MenuProperties")); + TypeDescription &td(TypeDescription::Create(TYPE_ID, "MenuProperties")); td.SetConstructor(&Construct); td.SetSize(sizeof(MenuProperties)); - td.AddField("font", FieldDescription(((char *)&p.font) - ((char *)&p), fontId).SetReferenced().SetDescription("the font to use for normal/enabled entries")); - td.AddField("disabledFont", FieldDescription(((char *)&p.disabledFont) - ((char *)&p), fontId).SetReferenced().SetDescription("the font for disabled entries")); - td.AddField("cursor", FieldDescription(((char *)&p.cursor) - ((char *)&p), spriteId).SetReferenced().SetDescription("the cursor sprite indicating the current selection")); - td.AddField("charsPerEntry", FieldDescription(((char *)&p.charsPerEntry) - ((char *)&p), numberId).SetDescription("width of an entry in characters")); - td.AddField("rows", FieldDescription(((char *)&p.rows) - ((char *)&p), numberId).SetDescription("number of visible rows")); - td.AddField("rowGap", FieldDescription(((char *)&p.rowGap) - ((char *)&p), numberId).SetDescription("space between rows in pixles")); - td.AddField("iconSpace", FieldDescription(((char *)&p.iconSpace) - ((char *)&p), numberId).SetDescription("space reserved for icons in pixels")); - td.AddField("cols", FieldDescription(((char *)&p.cols) - ((char *)&p), numberId).SetDescription("number of columns")); - td.AddField("colGap", FieldDescription(((char *)&p.colGap) - ((char *)&p), numberId).SetDescription("space between cols in pixels")); - td.AddField("delimiter", FieldDescription(((char *)&p.delimiter) - ((char *)&p), stringId).SetDescription("delimiter between text and number; only first character is used")); - td.AddField("charsPerNumber", FieldDescription(((char *)&p.charsPerNumber) - ((char *)&p), numberId).SetDescription("maximum width of a number in chars")); - td.AddField("charsPerAdditionalText", FieldDescription(((char *)&p.charsPerAdditionalText) - ((char *)&p), numberId).SetDescription("maximum number of additional text characters")); - td.AddField("additionalTextGap", FieldDescription(((char *)&p.additionalTextGap) - ((char *)&p), numberId).SetDescription("space between normal and additional text in pixels")); + td.AddField("font", FieldDescription(((char *)&p.font) - ((char *)&p), Font::TYPE_ID).SetReferenced().SetDescription("the font to use for normal/enabled entries")); + td.AddField("disabledFont", FieldDescription(((char *)&p.disabledFont) - ((char *)&p), Font::TYPE_ID).SetReferenced().SetDescription("the font for disabled entries")); + td.AddField("cursor", FieldDescription(((char *)&p.cursor) - ((char *)&p), Sprite::TYPE_ID).SetReferenced().SetDescription("the cursor sprite indicating the current selection")); + td.AddField("selectedCursor", FieldDescription(((char *)&p.selectedCursor) - ((char *)&p), Sprite::TYPE_ID).SetReferenced().SetDescription("the cursor sprite used when fixating a selection")); + td.AddField("charsPerEntry", FieldDescription(((char *)&p.charsPerEntry) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("width of an entry in characters")); + td.AddField("rows", FieldDescription(((char *)&p.rows) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("number of visible rows")); + td.AddField("rowGap", FieldDescription(((char *)&p.rowGap) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space between rows in pixles")); + td.AddField("iconSpace", FieldDescription(((char *)&p.iconSpace) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space reserved for icons in pixels")); + td.AddField("cols", FieldDescription(((char *)&p.cols) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("number of columns")); + td.AddField("colGap", FieldDescription(((char *)&p.colGap) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space between cols in pixels")); + td.AddField("delimiter", FieldDescription(((char *)&p.delimiter) - ((char *)&p), Interpreter::STRING_ID).SetDescription("delimiter between text and number; only first character is used")); + td.AddField("charsPerNumber", FieldDescription(((char *)&p.charsPerNumber) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("maximum width of a number in chars")); + td.AddField("charsPerAdditionalText", FieldDescription(((char *)&p.charsPerAdditionalText) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("maximum number of additional text characters")); + td.AddField("additionalTextGap", FieldDescription(((char *)&p.additionalTextGap) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space between normal and additional text in pixels")); + td.AddField("wrapX", FieldDescription(((char *)&p.wrapX) - ((char *)&p), Interpreter::BOOLEAN_ID).SetDescription("horizontally wrap cursor movement")); + td.AddField("wrapY", FieldDescription(((char *)&p.wrapY) - ((char *)&p), Interpreter::BOOLEAN_ID).SetDescription("vertically wrap cursor movement")); + td.AddField("thirdColumnHack", FieldDescription(((char *)&p.thirdColumnHack) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("offset the third column by this many characters")); } void MenuProperties::Construct(void *data) {