18 std::string title =
"(" + std::to_string(x) +
", " + std::to_string(
y) +
")";
21 bgcolor(Color::HSV(x * 255 / 15, 255,
y * 255 / 15));
25 std::vector<Elements> rows;
26 for (
int i = 0; i < 15; i++) {
27 std::vector<Element> cols;
28 for (
int j = 0; j < 15; j++) {
41 auto slider_x =
Slider(
"x", &focus_x, 0.f, 1.f, 0.01f);
42 auto slider_y =
Slider(
"y", &focus_y, 0.f, 1.f, 0.01f);
50 auto title =
"focusPositionRelative(" +
51 std::to_string(focus_x) +
", " +
52 std::to_string(focus_y) +
")";
65 auto screen = App::Fullscreen();
66 screen.Loop(renderer);
Element make_box(int x, int y)
Component Renderer(Component child, std::function< Element()>)
回傳一個新的 Component,類似 |child|,但使用 |render| 作為 Component::Render() 事件。
Element text(std::string_view text)
顯示一段 UTF8 編碼的 Unicode 文字。
Decorator focusPositionRelative(float x, float y)
在 frame 內部使用,這會強制視圖滾動到給定位置。該位置以請求大小的比例表示。
Decorator size(WidthOrHeight direction, Constraint constraint, int value)
對元素的大小套用限制。
Element flex(Element child)
讓子元素依比例擴展以填滿容器中剩餘的空間。
Element bgcolor(Color color, Element child)
設定元素的背景顏色。
Element separator()
在兩個元素之間繪製垂直或水平分隔線。
Element vbox(Elements children)
一個垂直一個接一個顯示元素的容器。
std::shared_ptr< Node > Element
Component Slider(SliderOption< T > options)
任意方向的滑桿。
Element gridbox(std::vector< Elements > lines)
A container displaying a grid of elements.