]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/Menu.h
added basic (non-functional) inventory menu
[l2e.git] / src / graphics / Menu.h
index 188c574b341b834e8c6fad6101fd1b85cfa8b6d8..e42f24e0cfcf7334777f99616aaa6fa34c44b990 100644 (file)
@@ -39,8 +39,8 @@ struct MenuProperties {
 
        MenuProperties()
        : font(0), disabledFont(0), cursor(0)
-       , charsPerEntry(0), rows(0), rowGap(0)
-       , iconSpace(0), cols(0), colGap(0)
+       , charsPerEntry(0), rows(1), rowGap(0)
+       , iconSpace(0), cols(1), colGap(0)
        , charsPerNumber(0), charsPerAdditionalText(0)
        , additionalTextGap(0), delimiter(':')
        , wrapX(false), wrapY(false) { }
@@ -214,6 +214,13 @@ void Menu<T>::Draw(SDL_Surface *dest, const geometry::Vector<int> &position) con
                geometry::Vector<int> iconOffset(
                                (i % cols) * (ColWidth() + colGap),
                                (i / cols) * RowHeight());
+
+               // Third column hack!
+               // This fixes the position of the "DROP" item in the inventory menu.
+               if (i % cols == 2) {
+                       iconOffset += geometry::Vector<int>(font->CharWidth(), 0);
+               }
+
                if (entries[start + i].icon) {
                        entries[start + i].icon->Draw(dest, position + iconOffset);
                }
@@ -234,7 +241,7 @@ void Menu<T>::Draw(SDL_Surface *dest, const geometry::Vector<int> &position) con
                if (charsPerNumber) {
                        usedFont->DrawChar(delimiter, dest, position + textOffset);
                        textOffset += geometry::Vector<int>(usedFont->CharWidth(), 0);
-                       usedFont->DrawNumber(entries[start + i].number, dest, position + textOffset);
+                       usedFont->DrawNumber(entries[start + i].number, dest, position + textOffset, charsPerNumber);
                }
        }
        geometry::Vector<int> cursorOffset(