diff --git a/examples/image_display/assets/images/note.txt b/examples/image_display/assets/images/note.txt deleted file mode 100644 index f1776f9..0000000 --- a/examples/image_display/assets/images/note.txt +++ /dev/null @@ -1,4 +0,0 @@ -请将 1.jpg 图片复制到此目录,并重命名为 demo.jpg - -源文件位置: C:\Users\soulcoco\Desktop\Extra2D\1.jpg -目标文件位置: C:\Users\soulcoco\Desktop\Extra2D\examples\image_display\assets\images\demo.jpg diff --git a/examples/text_rendering/main.cpp b/examples/text_rendering/main.cpp index 83da8bc..b7c54f4 100644 --- a/examples/text_rendering/main.cpp +++ b/examples/text_rendering/main.cpp @@ -57,7 +57,6 @@ public: float y = 100.0f; float x = 100.0f; - // 渲染标题(自动批处理,无需手动调用 begin/end) renderText(renderer, "Extra2D Text Rendering Demo", x, y, Color(1.0f, 0.8f, 0.2f, 1.0f)); y += font_->getLineHeight() * 2; @@ -91,8 +90,6 @@ public: // 渲染操作提示 renderText(renderer, "Press ESC to exit", x, y, Color(0.5f, 0.5f, 0.5f, 1.0f)); - - // 注意:无需手动调用 renderer.endSpriteBatch(),帧结束时会自动刷新 } void setRenderer(RenderBackend *renderer) { renderer_ = renderer; } @@ -120,9 +117,9 @@ int main(int argc, char *argv[]) { app.use([](auto &cfg) { cfg.w = 1280; cfg.h = 720; - cfg.title = "Extra2D Text Rendering Demo"; + cfg.title = "Extra2D 文字显示示例"; cfg.priority = 0; - cfg.backend = "glfw"; + cfg.backend = "sdl2"; }); app.use([](auto &cfg) { cfg.priority = 10; }); @@ -167,11 +164,11 @@ int main(int argc, char *argv[]) { // 配置相机 auto cameraService = ServiceLocator::instance().getService(); if (cameraService && win) { - ViewportConfig vpConfig; - vpConfig.logicWidth = static_cast(win->width()); - vpConfig.logicHeight = static_cast(win->height()); - vpConfig.mode = ViewportMode::AspectRatio; - cameraService->setViewportConfig(vpConfig); + cameraService->setViewportConfig([&](auto &cfg) { + cfg.logicWidth = static_cast(win->width()); + cfg.logicHeight = static_cast(win->height()); + cfg.mode = ViewportMode::AspectRatio; + }); cameraService->updateViewport(win->width(), win->height()); cameraService->applyViewportAdapter(); }