#include <iostream>

#include "mirage.h"
#include "window/mwindow.h"
#include "font/font_system.h"
#include "widget/widget_new.h"
#include "widget/compound_widget/mbutton.h"
#include "widget/leaf_widget/mtext_block.h"
#include "widget/panel_widget/mbox.h"

#include "freetype/freetype.h"
#include "freetype/ftlcdfil.h"

int main(int argc, char* argv[]) {
	mirage_app::get().init();

	auto& manager = font_manager::instance();
	// manager.add_font(L"C:/Users/46944/AppData/Local/Microsoft/Windows/Fonts/MapleMono-NF-CN-Regular.ttf");
	manager.add_font(L"C:/Windows/Fonts/msyh.ttc");
	// manager.add_font(L"D:/Projects/noto-emoji-2.047/fonts/Noto-COLRv1.ttf");
	manager.add_font(L"C:/Windows/Fonts/seguiemj.ttf");

	const auto& text_block = std::make_shared<mtext_block>();
	text_block->set_text(U"Hello, World! 你好，世界!🥶");

	const auto& text_block2 = std::make_shared<mtext_block>();
	text_block2->set_text(U"Hello, World!");

	const auto button = std::make_shared<mbutton>();
	button->set_content(text_block);

	const auto button2 = std::make_shared<mbutton>();
	button2->set_content(text_block2);

	const auto& window = mwindow::create({ 1024, 1024 }, L"Hello, World!");
	window->set_content(
		mnew(mh_box)
			mslot(mh_box)
			[
				button
			]
			mslot(mh_box)
			[
				button2
			]
	);

	mirage_app::get().run();
	return 0;
}
