]> git.localhorst.tv Git - l2e.git/blob - src/graphics/Menu.cpp
added menu cursor animations
[l2e.git] / src / graphics / Menu.cpp
1 #include "Menu.h"
2
3 #include "Animation.h"
4 #include "../loader/Interpreter.h"
5 #include "../loader/TypeDescription.h"
6
7 using loader::FieldDescription;
8 using loader::Interpreter;
9 using loader::TypeDescription;
10
11 namespace graphics {
12
13 void MenuProperties::CreateTypeDescription() {
14         MenuProperties p;
15
16         TypeDescription &td(TypeDescription::Create(TYPE_ID, "MenuProperties"));
17         td.SetConstructor(&Construct);
18         td.SetSize(sizeof(MenuProperties));
19
20         td.AddField("font", FieldDescription(((char *)&p.font) - ((char *)&p), Font::TYPE_ID).SetReferenced().SetDescription("the font to use for normal/enabled entries"));
21         td.AddField("disabledFont", FieldDescription(((char *)&p.disabledFont) - ((char *)&p), Font::TYPE_ID).SetReferenced().SetDescription("the font for disabled entries"));
22         td.AddField("cursor", FieldDescription(((char *)&p.cursor) - ((char *)&p), Sprite::TYPE_ID).SetReferenced().SetDescription("the cursor sprite indicating the current selection"));
23         td.AddField("selectedCursor", FieldDescription(((char *)&p.selectedCursor) - ((char *)&p), Sprite::TYPE_ID).SetReferenced().SetDescription("the cursor sprite used when fixating a selection"));
24         td.AddField("cursorAnimation", FieldDescription(((char *)&p.cursorAnimation) - ((char *)&p), Animation::TYPE_ID).SetReferenced().SetDescription("an animation for the cursor sprite"));
25         td.AddField("selectedCursorAnimation", FieldDescription(((char *)&p.selectedCursorAnimation) - ((char *)&p), Animation::TYPE_ID).SetReferenced().SetDescription("an animation for the selected cursor"));
26         td.AddField("charsPerEntry", FieldDescription(((char *)&p.charsPerEntry) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("width of an entry in characters"));
27         td.AddField("rows", FieldDescription(((char *)&p.rows) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("number of visible rows"));
28         td.AddField("rowGap", FieldDescription(((char *)&p.rowGap) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space between rows in pixles"));
29         td.AddField("iconSpace", FieldDescription(((char *)&p.iconSpace) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space reserved for icons in pixels"));
30         td.AddField("cols", FieldDescription(((char *)&p.cols) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("number of columns"));
31         td.AddField("colGap", FieldDescription(((char *)&p.colGap) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space between cols in pixels"));
32         td.AddField("delimiter", FieldDescription(((char *)&p.delimiter) - ((char *)&p), Interpreter::STRING_ID).SetDescription("delimiter between text and number; only first character is used"));
33         td.AddField("charsPerNumber", FieldDescription(((char *)&p.charsPerNumber) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("maximum width of a number in chars"));
34         td.AddField("charsPerAdditionalText", FieldDescription(((char *)&p.charsPerAdditionalText) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("maximum number of additional text characters"));
35         td.AddField("additionalTextGap", FieldDescription(((char *)&p.additionalTextGap) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("space between normal and additional text in pixels"));
36         td.AddField("wrapX", FieldDescription(((char *)&p.wrapX) - ((char *)&p), Interpreter::BOOLEAN_ID).SetDescription("horizontally wrap cursor movement"));
37         td.AddField("wrapY", FieldDescription(((char *)&p.wrapY) - ((char *)&p), Interpreter::BOOLEAN_ID).SetDescription("vertically wrap cursor movement"));
38         td.AddField("thirdColumnHack", FieldDescription(((char *)&p.thirdColumnHack) - ((char *)&p), Interpreter::NUMBER_ID).SetDescription("offset the third column by this many characters"));
39 }
40
41 void MenuProperties::Construct(void *data) {
42         new (data) MenuProperties;
43 }
44
45 }