Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions assets/ui/level-menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,25 @@
255
]
},
"enter-hint": {
"play-hint": {
"x": 16,
"y": 166,
"size": 1,
"color": [
120,
120,
120,
250,
200,
46,
255
]
},
"enter-hint": {
"x": 40,
"y": 166,
"size": 1,
"color": [
180,
180,
180,
255
]
},
Expand Down
2 changes: 2 additions & 0 deletions include/wforge/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class SceneManager {
void changeScene(Scene new_scene);
void handleEvent(sf::Event &evt);
void tick();
void setWindowTitle(std::string title);
Copy link

Copilot AI Nov 30, 2025

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.

Suggested change
void setWindowTitle(std::string title);
void setWindowTitle(const std::string& title);

Copilot uses AI. Check for mistakes.

sf::Vector2i mousePosition() const;
int scale() const {
Expand Down Expand Up @@ -228,6 +229,7 @@ struct LevelSelectionMenu {
UITextDescriptor _level_title;
UITextDescriptor _level_desc;
UITextDescriptor _level_difficulty;
UITextDescriptor _play_hint;
UITextDescriptor _enter_hint;
std::vector<std::array<int, 2>> _level_button;
std::vector<std::array<int, 2>> _level_links;
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/credits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ std::array<int, 2> Credits::size() const {
}

void Credits::setup(SceneManager &mgr) {
// nothing to do
mgr.setWindowTitle("Credits");
}

void Credits::handleEvent(SceneManager &mgr, sf::Event &evt) {
Expand Down
4 changes: 3 additions & 1 deletion src/scenes/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ void Help::handleEvent(SceneManager &mgr, sf::Event &evt) {
}
}

void Help::setup(SceneManager &mgr) {}
void Help::setup(SceneManager &mgr) {
mgr.setWindowTitle("Help");
}
void Help::step(SceneManager &mgr) {}

void Help::render(
Expand Down
1 change: 1 addition & 0 deletions src/scenes/level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ std::array<int, 2> LevelPlaying::size() const {
}

void LevelPlaying::setup(SceneManager &mgr) {
mgr.setWindowTitle(std::format("Level {} - {}", _level.metadata.index + 1, _level.metadata.name));
_level.selectItem(0);
mgr.bgm.setCollection("background/level-music");
const auto &bgm_fade = FadeIOConfig::load();
Expand Down
5 changes: 4 additions & 1 deletion src/scenes/level_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ LevelSelectionMenu::LevelSelectionMenu()
_level_difficulty = UITextDescriptor::fromJson(
json_data.at("level-difficulty")
);
_play_hint = UITextDescriptor::fromJson(json_data.at("play-hint"));
_enter_hint = UITextDescriptor::fromJson(json_data.at("enter-hint"));

for (const auto &btn : json_data.at("level-buttons")) {
Expand Down Expand Up @@ -77,6 +78,7 @@ std::array<int, 2> LevelSelectionMenu::size() const {

void LevelSelectionMenu::setup(SceneManager &mgr) {
mgr.bgm.setCollection("background/main-menu-music");
mgr.setWindowTitle("Level Selection");
}

void LevelSelectionMenu::handleEvent(SceneManager &mgr, sf::Event &evt) {
Expand Down Expand Up @@ -271,7 +273,8 @@ void LevelSelectionMenu::render(
);

// Render enter hint
_enter_hint.render(target, font, "[ENTER]", scale);
_play_hint.render(target, font, "Play", scale);
_enter_hint.render(target, font, "[Enter]", scale);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/scenes/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ std::array<int, 2> MainMenu::size() const {
}

void MainMenu::setup(SceneManager &mgr) {
mgr.setWindowTitle("Waveforge " WAVEFORGE_VERSION "alpha");
Copy link

Copilot AI Nov 30, 2025

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.

Suggested change
mgr.setWindowTitle("Waveforge " WAVEFORGE_VERSION "alpha");
mgr.setWindowTitle("Waveforge " WAVEFORGE_VERSION " alpha");

Copilot uses AI. Check for mistakes.
mgr.bgm.setCollection("background/main-menu-music");
}

Expand Down
4 changes: 4 additions & 0 deletions src/scenes/scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ void SceneManager::changeScene(Scene new_scene) {
_scene_changed = true;
}

void SceneManager::setWindowTitle(std::string title) {
Copy link

Copilot AI Nov 30, 2025

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.

Suggested change
void SceneManager::setWindowTitle(std::string title) {
void SceneManager::setWindowTitle(const std::string& title) {

Copilot uses AI. Check for mistakes.
window.setTitle(title);
}

void SceneManager::handleEvent(sf::Event &evt) {
_current_scene->handleEvent(*this, evt);
}
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ std::array<int, 2> SettingsMenu::size() const {
}

void SettingsMenu::setup(SceneManager &mgr) {
// nothing to do here
mgr.setWindowTitle("Settings");
}

void SettingsMenu::handleEvent(SceneManager &mgr, sf::Event &evt) {
Expand Down