Class SpacerNode

#include <Geode/cocos/base_nodes/SpacerNode.hpp>
classSpacerNode:publiccocos2d::CCNode{ ... }

A node for controlling spacing in Layouts. When a Layout is applied, if space is left over, the remaining space is divided among all SpacerNodes in the Layout. The space each node gets is the proprotion between its growth factor and the sum of all the SpacerNodes’ growth factors in the Layout

ℹ If you want to specify a minimum width for a SpacerNode, add AxisLayoutOptions for it and use setLength

Examples1
node->addChild(SpacerNode::create(1));
node->addChild(SpacerNode::create(2));
node->addChild(SpacerNode::create(1));
node->updateLayout();
// Total SpacerNode growth sum is 1 + 2 + 1 = 4
// So s1 and s3 get 1/4 of the remaining space and s2 gets 2/4
Public static methods1
staticcocos2d::SpacerNode*create(
size_tgrow
)

Create a new spacer node. When the layout is applied, if there is space left over the remaining space is distributed among all spacer nodes in proportion to the sum of all the spacers’ grow factors (akin to CSS flew grow)

Parameters

grow

The grow factor for this node. Default is 1
Public member functions2
voidsetGrow(
size_tgrow
)

Set the grow factor for this spacer node. When the layout is applied, if there is space left over the remaining space is distributed among all spacer nodes in proportion to the sum of all the spacers’ grow factors (akin to CSS flew grow)

Parameters

grow

The new grow factor for this node. Default is 1

ℹ Make sure to call updateLayout on the spacer's parent afterwards

size_tgetGrow()const

Get the grow factor for this spacer node

Fields0
Protected member functions1
boolinit(
size_tgrow
)
No description provided
Protected fields1
size_tm_grow
;
No description provided