| 319 | } |
| 320 | |
| 321 | void Menu::alignItemsHorizontallyWithPadding(float padding) |
| 322 | { |
| 323 | float width = -padding; |
| 324 | for (const auto& child : _children) |
| 325 | width += child->getContentSize().width * child->getScaleX() + padding; |
| 326 | |
| 327 | float x = -width / 2.0f; |
| 328 | |
| 329 | for (const auto& child : _children) |
| 330 | { |
| 331 | child->setPosition(x + child->getContentSize().width * child->getScaleX() / 2.0f, 0); |
| 332 | x += child->getContentSize().width * child->getScaleX() + padding; |
| 333 | } |
| 334 | } |
| 335 | |
| 336 | void Menu::alignItemsInColumns(int columns, ...) |
| 337 | { |