Files
mirage/example/src/main.cpp
2025-03-23 10:57:42 +08:00

81 lines
1.3 KiB
C++

//
// Created by Administrator on 25-2-26.
//
#include "mirage.h"
#include "core/window/mwindow.h"
#include "widget/compound_widget/mbutton.h"
#include "widget/panel_widget/mbox.h"
int main(int argc, char* argv[]) {
mirage_app app;
app.init();
auto window = std::make_shared<mwindow>();
window->create_window(800, 600, L"Hello, World!");
window->show();
mirage_app::get_render_context()->setup_surface(window.get());
auto border = std::make_shared<mborder>();
auto h_box = std::make_shared<mh_box>();
window->set_content(h_box);
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>()
];
app.run();
return 0;
}