| 298 | } |
| 299 | |
| 300 | void Menu::alignItemsVerticallyWithPadding(float padding) |
| 301 | { |
| 302 | float height = -padding; |
| 303 | |
| 304 | for (const auto& child : _children) |
| 305 | height += child->getContentSize().height * child->getScaleY() + padding; |
| 306 | |
| 307 | float y = height / 2.0f; |
| 308 | |
| 309 | for (const auto& child : _children) |
| 310 | { |
| 311 | child->setPosition(0, y - child->getContentSize().height * child->getScaleY() / 2.0f); |
| 312 | y -= child->getContentSize().height * child->getScaleY() + padding; |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | void Menu::alignItemsHorizontally() |
| 317 | { |