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
src
modules
ui
vbox.cpp
Go to the documentation of this file.
1
#include "
./asw/modules/ui/vbox.h
"
2
3
void
asw::ui::VBox::layout
(
Context
& ctx)
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
}
asw::Quad::size
Vec2< T > size
The size of the rectangle.
Definition
geometry.h:555
asw::Quad::position
Vec2< T > position
The position of the rectangle.
Definition
geometry.h:552
asw::Vec2::y
T y
The y component of the vector.
Definition
geometry.h:196
asw::Vec2::x
T x
The x component of the vector.
Definition
geometry.h:193
asw::ui::Context
Shared state for the UI system.
Definition
context.h:75
asw::ui::VBox::layout
void layout(Context &ctx) override
Lay out children vertically.
Definition
vbox.cpp:3
asw::ui::VBox::gap
float gap
Gap between child elements.
Definition
vbox.h:22
asw::ui::VBox::padding
float padding
Padding around the content.
Definition
vbox.h:25
asw::ui::Widget::transform
asw::Quad< float > transform
The transform (position and size) of the widget.
Definition
widget.h:119
asw::ui::Widget::children
std::vector< std::unique_ptr< Widget > > children
Child widgets.
Definition
widget.h:72
vbox.h
Vertical box layout widget for the ASW UI module.
Generated by
1.12.0