X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fgraphics%2FMenu.h;h=e42f24e0cfcf7334777f99616aaa6fa34c44b990;hb=c1de2db3755c2cffd790c58bbd92e7fc993afcb5;hp=188c574b341b834e8c6fad6101fd1b85cfa8b6d8;hpb=7e59a87ac7caf96ffa38f2595581a6009a20339a;p=l2e.git diff --git a/src/graphics/Menu.h b/src/graphics/Menu.h index 188c574..e42f24e 100644 --- a/src/graphics/Menu.h +++ b/src/graphics/Menu.h @@ -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::Draw(SDL_Surface *dest, const geometry::Vector &position) con geometry::Vector 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(font->CharWidth(), 0); + } + if (entries[start + i].icon) { entries[start + i].icon->Draw(dest, position + iconOffset); } @@ -234,7 +241,7 @@ void Menu::Draw(SDL_Surface *dest, const geometry::Vector &position) con if (charsPerNumber) { usedFont->DrawChar(delimiter, dest, position + textOffset); textOffset += geometry::Vector(usedFont->CharWidth(), 0); - usedFont->DrawNumber(entries[start + i].number, dest, position + textOffset); + usedFont->DrawNumber(entries[start + i].number, dest, position + textOffset, charsPerNumber); } } geometry::Vector cursorOffset(