-
Notifications
You must be signed in to change notification settings - Fork 3
Window title #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Window title #9
Conversation
Signed-off-by: ZTL-UwU <zhangtianli2006@gmail.com>
Signed-off-by: ZTL-UwU <zhangtianli2006@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) { |
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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"); |
Copilot
AI
Nov 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.