文本绘制
This commit is contained in:
@@ -1,42 +1,24 @@
|
||||
//
|
||||
// Created by Administrator on 25-2-26.
|
||||
//
|
||||
|
||||
#include "mirage.h"
|
||||
#include "window/mwindow.h"
|
||||
#include "widget/compound_widget/mbutton.h"
|
||||
#include "widget/panel_widget/mbox.h"
|
||||
#include "pixel.h"
|
||||
#include "misc/mapped_file/mapped_file.h"
|
||||
#include "stb_image_loader.h"
|
||||
#include "font/font_atlas_system.h"
|
||||
#include "font/font_face.h"
|
||||
#include "texture/texture2d.h"
|
||||
#include "font/font_system.h"
|
||||
#include "widget/widget_new.h"
|
||||
#include "widget/leaf_widget/mimage.h"
|
||||
#include "widget/leaf_widget/mtext_block.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
mirage_app::get().init();
|
||||
|
||||
auto& manager = font_manager::instance();
|
||||
manager.add_font(L"C:/Windows/Fonts/msyh.ttc");
|
||||
|
||||
{
|
||||
font_face_t face;
|
||||
face.load_from_file(L"C:/Windows/Fonts/segmdl2.ttf");
|
||||
auto name = face.get_font_name();
|
||||
auto color = face.supports_color_emoji();
|
||||
}
|
||||
auto text_block = std::make_shared<mtext_block>();
|
||||
text_block->set_text("Hello, World!");
|
||||
|
||||
auto image2 = std::make_shared<mimage>();
|
||||
image2->set_sampler(sampler_type::linear_clamp);
|
||||
|
||||
const auto& window = mwindow::create({ 800, 600 }, L"Hello, World!");
|
||||
window->set_content(
|
||||
mnew(mh_box)
|
||||
|
||||
mslot(mh_box)
|
||||
[
|
||||
image2
|
||||
].stretch()
|
||||
);
|
||||
const auto& window = mwindow::create({ 1024, 1024 }, L"Hello, World!");
|
||||
window->set_content(text_block);
|
||||
|
||||
mirage_app::get().run();
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user