Skip to content

Commit e82e0ea

Browse files
committed
centre icons
1 parent 08488ae commit e82e0ea

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Source/Menus/BuyMenuGUI.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2266,9 +2266,13 @@ void BuyMenuGUI::AddPresetsToItemList() {
22662266
continue; // don't draw anything that would overflow the bitmap
22672267
}
22682268

2269-
draw_sprite(pItemBitmap->GetBitmap(), sceneObject->GetGraphicalIcon(), widthOffset, heightOffset);
2270-
22712269
rowHeight = std::max(rowHeight, sceneObject->GetGraphicalIcon()->h);
2270+
2271+
// TODO: make a smarter row structure so we can properly centre the icons if the actor isn't the tallest item in the row
2272+
// Vertically center the icon in the row
2273+
int yOffset = (rowHeight - sceneObject->GetGraphicalIcon()->h) / 2;
2274+
2275+
draw_sprite(pItemBitmap->GetBitmap(), sceneObject->GetGraphicalIcon(), widthOffset, heightOffset + yOffset);
22722276
widthOffset += sceneObject->GetGraphicalIcon()->w;
22732277
}
22742278

0 commit comments

Comments
 (0)