MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / alignItemsHorizontallyWithPadding

Method alignItemsHorizontallyWithPadding

Source/GameToolbox/nodes.cpp:199–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199void 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
212void GameToolbox::alignItemsVerticallyWithPadding(ax::Vector<ax::Node*> _children, float padding) {
213 float height = -padding;

Callers 6

initMethod · 0.80
initMethod · 0.80
initMethod · 0.80
initMethod · 0.80
setupIconSelectMethod · 0.80
initMethod · 0.80

Calls 1

setPositionMethod · 0.80

Tested by

no test coverage detected