int centerY = 100; // Position of the central menu item on the y-axis.
int x = 0; // Position on the x-axis to draw items.
int selectedIndex = 0; // Index of select menu item.
int menuHeight = 10; // Height of each menu item.
for (int i = 0; i < selectedIndex; i++)
{
int y = (centerY - (((selectedIndex - 1) - i) * menuHeight));
DrawMenuItem(i, x, y);
}
DrawMenuItem(selectedIndex, x, y);
for (int i = selectedIndex + 1; i < menuItemCount; i++)
{
int y = centerY + ((i - selectedIndex) * menuHeight);
DrawMenuItem(i, x, y)
}
Bleh, probably an easier way to do it. But its 3am and I'm to tired D:
This algorithem is also assuming the origin of the menu item being drawn is (0,0).