Skip to content

Commit 3ba95ea

Browse files
committed
Add BoxContainer alignment to examples
1 parent 79e4047 commit 3ba95ea

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

examples/container_layout/main.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,23 @@ class MyNode : public Node {
6262
}
6363
vbox_container->set_size({200, 300});
6464

65+
// BoxContainer alignment.
66+
{
67+
auto box_container = std::make_shared<VBoxContainer>();
68+
box_container->set_separation(8);
69+
box_container->set_position({350, 250});
70+
box_container->theme_override_bg = StyleBox();
71+
box_container->set_alignment(BoxContainerAlignment::End);
72+
add_child(box_container);
73+
74+
for (int i = 0; i < 3; i++) {
75+
auto label = std::make_shared<Label>();
76+
box_container->add_child(label);
77+
label->set_text("Label " + std::to_string(i));
78+
}
79+
box_container->set_size({100, 200});
80+
}
81+
6582
auto grid_container = std::make_shared<GridContainer>();
6683
grid_container->set_separation(8);
6784
grid_container->set_position({600, 400});

0 commit comments

Comments
 (0)