From ede8dfbb26e11c1eb2b3d1e9ed10f8fb1e8bfd6f Mon Sep 17 00:00:00 2001 From: zhenyan121 <3367366583@qq.com> Date: Wed, 4 Feb 2026 16:38:21 +0800 Subject: [PATCH] feat: Add GameTitle --- src/scenes/menu/MainMenuScene.cpp | 6 +++--- src/ui/managers/MainMenuUIManager.cpp | 7 +++++++ src/utils/Config.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/scenes/menu/MainMenuScene.cpp b/src/scenes/menu/MainMenuScene.cpp index fd83662..a224920 100644 --- a/src/scenes/menu/MainMenuScene.cpp +++ b/src/scenes/menu/MainMenuScene.cpp @@ -30,10 +30,10 @@ void MainMenuScene::update() { void MainMenuScene::renderWorld() { - SDL_FRect test = {20, 20, 20, 20}; + //SDL_FRect test = {20, 20, 20, 20}; // 渲染场景内容 - SDL_SetRenderDrawColor(m_renderer, 20, 20,20, 255); - SDL_RenderFillRect(m_renderer, &test); + //SDL_SetRenderDrawColor(m_renderer, 20, 20,20, 255); + //SDL_RenderFillRect(m_renderer, &test); } diff --git a/src/ui/managers/MainMenuUIManager.cpp b/src/ui/managers/MainMenuUIManager.cpp index f314b9e..7c56f95 100644 --- a/src/ui/managers/MainMenuUIManager.cpp +++ b/src/ui/managers/MainMenuUIManager.cpp @@ -25,6 +25,13 @@ void MainMenuUIManager::init() { ); m_buttons.emplace(onlineStartButton->getNameHash(), std::move(onlineStartButton)); + + auto titelLabel = UIWidgetFactory::createStandardLabel( + "TitleLabel", "SporeBG-Conid", 275, 20 + ); + titelLabel->setRect(225, 20, UI::TitleSize, UI::TitleSize); + titelLabel->setText("SporeBG-Conid", {"SourceHanSansSC-Regular.otf", UI::UI_NORMAL_FONT_SIZE * 2, {173, 216, 189, 255}}); + m_labels.emplace(titelLabel->getNameHash(), std::move(titelLabel)); } diff --git a/src/utils/Config.h b/src/utils/Config.h index 2d4a0d0..52f57d9 100644 --- a/src/utils/Config.h +++ b/src/utils/Config.h @@ -49,6 +49,7 @@ namespace UI constexpr int LogicalWidth = 640; constexpr int LogicalHeight = 360; + constexpr int TitleSize = 16 * 8; // 字体大小(逻辑像素) constexpr int DIALOG_FONT_SIZE = 14; constexpr int UI_SMALL_FONT_SIZE = 8;