ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
vbox.cpp
Go to the documentation of this file.
2
4{
5 float y = transform.position.y + padding;
6 const float x = transform.position.x + padding;
7 const float w = transform.size.x - (padding * 2.0F);
8
9 for (auto const& c : children) {
10 if (!c->visible) {
11 continue;
12 }
13
14 c->transform.position.x = x;
15 c->transform.position.y = y;
16 c->transform.size.x = w;
17 c->layout(ctx);
18 y += c->transform.size.y + gap;
19 }
20}
Vec2< T > size
The size of the rectangle.
Definition geometry.h:555
Vec2< T > position
The position of the rectangle.
Definition geometry.h:552
T y
The y component of the vector.
Definition geometry.h:196
T x
The x component of the vector.
Definition geometry.h:193
Shared state for the UI system.
Definition context.h:75
void layout(Context &ctx) override
Lay out children vertically.
Definition vbox.cpp:3
float gap
Gap between child elements.
Definition vbox.h:22
float padding
Padding around the content.
Definition vbox.h:25
asw::Quad< float > transform
The transform (position and size) of the widget.
Definition widget.h:119
std::vector< std::unique_ptr< Widget > > children
Child widgets.
Definition widget.h:72
Vertical box layout widget for the ASW UI module.