ECS模式初版
This commit is contained in:
@@ -17,62 +17,15 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
mirage_app::get_render_context()->setup_surface(window.get());
|
||||
|
||||
auto border = std::make_shared<mborder>();
|
||||
widget_manager::get().init_window(window);
|
||||
|
||||
auto h_box = std::make_shared<mh_box>();
|
||||
window->set_content(h_box);
|
||||
auto weak_border = widget_manager::get().new_widget<mborder>(window.get());
|
||||
auto border = weak_border.lock();
|
||||
auto button = widget_manager::get().new_widget<mbutton>(window.get());
|
||||
border->set_content(button.lock())
|
||||
.margin({5});
|
||||
|
||||
auto v_box = std::make_shared<mv_box>();
|
||||
v_box->add_slot()
|
||||
.auto_size()
|
||||
.margin({ 5 })
|
||||
[
|
||||
std::make_shared<mbutton>()
|
||||
];
|
||||
v_box->add_slot()
|
||||
.stretch()
|
||||
.margin({ 5 })
|
||||
[
|
||||
std::make_shared<mbutton>()
|
||||
];
|
||||
v_box->add_slot()
|
||||
.auto_size()
|
||||
.margin({ 5 })
|
||||
[
|
||||
std::make_shared<mbutton>()
|
||||
];
|
||||
|
||||
|
||||
h_box->add_slot()
|
||||
.auto_size()
|
||||
.margin({ 5 })
|
||||
[
|
||||
std::make_shared<mbutton>()
|
||||
];
|
||||
h_box->add_slot()
|
||||
.auto_size()
|
||||
.margin({ 5 })
|
||||
[
|
||||
std::make_shared<mbutton>()
|
||||
];
|
||||
h_box->add_slot()
|
||||
.auto_size()
|
||||
.margin({ 5 })
|
||||
[
|
||||
std::make_shared<mbutton>()
|
||||
];
|
||||
h_box->add_slot()
|
||||
.stretch()
|
||||
[
|
||||
v_box
|
||||
];
|
||||
|
||||
h_box->add_slot()
|
||||
.stretch()
|
||||
.margin({ 5 })
|
||||
[
|
||||
std::make_shared<mbutton>()
|
||||
];
|
||||
window->set_content(border);
|
||||
|
||||
|
||||
app.run();
|
||||
|
||||
Reference in New Issue
Block a user