60 lines
1.6 KiB
C++
60 lines
1.6 KiB
C++
#include "layout/stack.h"
|
|
#include "button.h"
|
|
#include "layout/overlay.h"
|
|
#include "imager.h"
|
|
#include "post_effect.h"
|
|
#include "mask/rounded_rect_mask.h"
|
|
#include "mask/circle_mask.h"
|
|
#include "mask/mask_widget.h"
|
|
#include "layout/modifiers/modifiers.h"
|
|
#include <iostream>
|
|
|
|
using namespace mirage;
|
|
using namespace mirage::modifier; // For align, padding, stretch, mask
|
|
|
|
void test_syntax() {
|
|
auto on_click = []() { std::cout << "Clicked!" << std::endl; };
|
|
uint32_t texture_id_ = 1;
|
|
vec2i_t texture_size_{100, 100};
|
|
|
|
v_stack v{
|
|
// Standard widget placement
|
|
button{
|
|
"Hello",
|
|
on_click
|
|
},
|
|
// Using | pipe operator
|
|
overlay{
|
|
// Using pipe syntax for alignment and padding
|
|
imager{}
|
|
.texture_id(texture_id_)
|
|
.fit(image_fit::contain)
|
|
.set_texture_size(texture_size_)
|
|
| mask(rounded_rect_mask{}.corner_radius(30.f))
|
|
| align(alignment::CENTER)
|
|
| padding(10.f),
|
|
// Standard post-effect widget
|
|
post_effect_widget{
|
|
blur_effect{20.f}
|
|
},
|
|
} | stretch(),
|
|
overlay{
|
|
imager{}
|
|
.texture_id(texture_id_)
|
|
.fit(image_fit::contain)
|
|
.set_texture_size(texture_size_)
|
|
| align(alignment::CENTER)
|
|
| padding(10.f),
|
|
post_effect_widget{
|
|
blur_effect{20.f}
|
|
}
|
|
} | stretch() | mask(circle_mask{})
|
|
};
|
|
|
|
(void)v; // Suppress unused variable warning
|
|
}
|
|
|
|
int main() {
|
|
test_syntax();
|
|
return 0;
|
|
} |