Added a lots of the file to write the pixel game but due to some problem ,i dicide to change sdl3 to sfml,a more modern lib

This commit is contained in:
2025-12-21 14:58:33 +08:00
parent 96b005e2ef
commit 86dce63e74
15 changed files with 443 additions and 51 deletions

View File

@@ -13,19 +13,26 @@ MainMenuUIManager::~MainMenuUIManager() {
}
void MainMenuUIManager::init() {
auto button = std::make_unique<Button>(m_textRenderer);
auto button = std::make_unique<Button>();
button->setBackgroundColor({0, 150, 255, 255});
button->setBorder(2, {0, 0, 0, 255});
button->setPosition(650, 430);
button->setRect(0, 0, UI::ButtonSize * 4, UI::ButtonSize * 2);
button->setName("StartButton");
button->setText("Start Game", {"SourceHanSansSC-Regular.otf", 64, {255, 255, 255, 255}});
button->setText("Start Game", {"SourceHanSansSC-Regular.otf", UI::UI_NORMAL_FONT_SIZE, {255, 255, 255, 255}});
button->setCallback([this](){
SDL_Log("Start Game button clicked!");
m_eventCallback("GameScene");
});
m_buttons.emplace(button->getNameHash(), std::move(button));
auto label = std::make_unique<Label>();
label->setPosition(1200, 20);
label->setRect(1200, 20, 200, 50);
label->setText("0 0", {"SourceHanSansSC-Regular.otf", 48, {0, 0, 0, 255}});
label->setName("MousePositionLabel");
m_labels.emplace(label->getNameHash(), std::move(label));