Conversation
Signed-off-by: ZTL-UwU <zhangtianli2006@gmail.com>
Signed-off-by: ZTL-UwU <zhangtianli2006@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR adds dynamic window title functionality to the game, allowing each scene to set an appropriate window title when it becomes active. The implementation adds a new setWindowTitle method to SceneManager and updates all scene setup() methods to set descriptive titles.
- Added
SceneManager::setWindowTitle()method to enable scenes to update the window title - Updated all scene
setup()methods to set appropriate window titles ("Settings", "Help", "Credits", "Level Selection", and formatted level names) - Enhanced the level menu UI by splitting the play hint into separate "Play" and "[Enter]" text elements with different styling
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| include/wforge/scene.h | Added setWindowTitle method declaration and _play_hint UI descriptor field |
| src/scenes/scene.cpp | Implemented setWindowTitle method to update window title |
| src/scenes/settings.cpp | Added window title "Settings" in setup method |
| src/scenes/main_menu.cpp | Added window title with version string in setup method |
| src/scenes/level_menu.cpp | Added window title "Level Selection" and separated play hint rendering |
| src/scenes/level.cpp | Added dynamic window title with level number and name |
| src/scenes/help.cpp | Added window title "Help" in setup method |
| src/scenes/credits.cpp | Added window title "Credits" in setup method |
| assets/ui/level-menu.json | Split enter-hint configuration into separate play-hint and enter-hint entries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| _scene_changed = true; | ||
| } | ||
|
|
||
| void SceneManager::setWindowTitle(std::string title) { |
There was a problem hiding this comment.
The title parameter should be passed by const reference (const std::string&) instead of by value to avoid unnecessary string copies. This improves performance and follows C++ best practices for passing strings to functions that don't need ownership.
| void SceneManager::setWindowTitle(std::string title) { | |
| void SceneManager::setWindowTitle(const std::string& title) { |
| void changeScene(Scene new_scene); | ||
| void handleEvent(sf::Event &evt); | ||
| void tick(); | ||
| void setWindowTitle(std::string title); |
There was a problem hiding this comment.
The title parameter should be passed by const reference (const std::string&) instead of by value to avoid unnecessary string copies. This improves performance and follows C++ best practices for passing strings to functions that don't need ownership.
| void setWindowTitle(std::string title); | |
| void setWindowTitle(const std::string& title); |
| } | ||
|
|
||
| void MainMenu::setup(SceneManager &mgr) { | ||
| mgr.setWindowTitle("Waveforge " WAVEFORGE_VERSION "alpha"); |
There was a problem hiding this comment.
Missing space between the version string and "alpha". This should be "Waveforge " WAVEFORGE_VERSION " alpha" to ensure proper spacing in the window title.
| mgr.setWindowTitle("Waveforge " WAVEFORGE_VERSION "alpha"); | |
| mgr.setWindowTitle("Waveforge " WAVEFORGE_VERSION " alpha"); |
No description provided.