嵌套语法
This commit is contained in:
@@ -10,24 +10,25 @@
|
||||
#include "misc/mapped_file/mapped_file.h"
|
||||
#include "stb_image_loader.h"
|
||||
#include "render/texture2d.h"
|
||||
#include "widget/widget_new.h"
|
||||
#include "widget/leaf_widget/mimage.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
mirage_app::get().init();
|
||||
|
||||
|
||||
// auto i = std::make_shared<texture2d>();
|
||||
auto i = std::make_shared<texture2d>();
|
||||
auto ii = std::make_shared<texture2d>();
|
||||
|
||||
// {
|
||||
// auto file = mapped_file::create();
|
||||
// file->map_file(L"Z:/Root/Local/NanakoDisk/涩图/可爱偷猴计划/蕾米莉亚 & 芙兰朵露/1708702057588.jpg");
|
||||
// stb_image_loader image_loader;
|
||||
// image_loader.init(file->get_data(), file->get_size());
|
||||
// const auto& heap = image_loader.load();
|
||||
//
|
||||
// i->create(heap->data, { heap->info.width, heap->info.height }, heap->info.get_pixel_format());
|
||||
// }
|
||||
{
|
||||
auto file = mapped_file::create();
|
||||
file->map_file(L"Z:/Root/Local/NanakoDisk/涩图/可爱偷猴计划/蕾米莉亚 & 芙兰朵露/1708702057588.jpg");
|
||||
stb_image_loader image_loader;
|
||||
image_loader.init(file->get_data(), file->get_size());
|
||||
const auto& heap = image_loader.load();
|
||||
|
||||
i->create(heap->data, { heap->info.width, heap->info.height }, heap->info.get_pixel_format());
|
||||
}
|
||||
{
|
||||
auto file = mapped_file::create();
|
||||
file->map_file(L"Z:/Root/Local/NanakoDisk/涩图/可爱偷猴计划/蕾米莉亚 & 芙兰朵露/1712938522333.jpg");
|
||||
@@ -38,21 +39,30 @@ int main(int argc, char* argv[]) {
|
||||
ii->create(heap->data, { heap->info.width, heap->info.height }, heap->info.get_pixel_format());
|
||||
}
|
||||
|
||||
// auto image = std::make_shared<mimage>();
|
||||
// image->set_image(i);
|
||||
|
||||
auto image = std::make_shared<mimage>();
|
||||
image->set_image(i);
|
||||
auto image2 = std::make_shared<mimage>();
|
||||
image2->set_image(ii);
|
||||
image2->set_sampler(sampler_type::linear_clamp);
|
||||
|
||||
auto root = std::make_shared<mborder>();
|
||||
|
||||
root->set_content(image2)
|
||||
.h_alignment(horizontal_alignment_t::center)
|
||||
.v_alignment(vertical_alignment_t::center);
|
||||
|
||||
const auto& window = mwindow::create({ 800, 600 }, L"Hello, World!");
|
||||
window->set_content(root);
|
||||
window->set_content(
|
||||
mnew(mh_box)
|
||||
|
||||
mslot(mh_box)
|
||||
[
|
||||
mnew(mborder)
|
||||
[
|
||||
image
|
||||
]
|
||||
.margin({ 5 })
|
||||
]
|
||||
|
||||
mslot(mh_box)
|
||||
[
|
||||
image2
|
||||
].stretch()
|
||||
);
|
||||
|
||||
mirage_app::get().run();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user