| 197 | } |
| 198 | |
| 199 | void GameToolbox::alignItemsHorizontallyWithPadding(ax::Vector<ax::Node*> _children, float padding) { |
| 200 | float width = -padding; |
| 201 | for (const auto& child : _children) |
| 202 | width += child->getContentSize().width * child->getScaleX() + padding; |
| 203 | |
| 204 | float x = -width / 2.0f; |
| 205 | |
| 206 | for (const auto& child : _children) { |
| 207 | child->setPosition(x + child->getContentSize().width * child->getScaleX() / 2.0f, 0); |
| 208 | x += child->getContentSize().width * child->getScaleX() + padding; |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | void GameToolbox::alignItemsVerticallyWithPadding(ax::Vector<ax::Node*> _children, float padding) { |
| 213 | float height = -padding; |
no test coverage detected