Gameplay Screen now stops on his own
This commit is contained in:
parent
498bddc823
commit
16a689a43e
3
TODO.md
3
TODO.md
@ -1,5 +1,8 @@
|
|||||||
# v0.1.0 (MVP)
|
# v0.1.0 (MVP)
|
||||||
## Misc
|
## Misc
|
||||||
|
- Logging system
|
||||||
|
- Crash handling
|
||||||
|
- Option Menu For Audio Lag and Input Lag
|
||||||
|
|
||||||
## Gameplay Screen
|
## Gameplay Screen
|
||||||
- Score
|
- Score
|
||||||
|
@ -62,6 +62,9 @@ namespace Gameplay {
|
|||||||
}
|
}
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||||
}
|
}
|
||||||
|
if (render_thread.joinable()) {
|
||||||
|
render_thread.join();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::render(sf::RenderWindow& window) {
|
void Screen::render(sf::RenderWindow& window) {
|
||||||
@ -69,6 +72,7 @@ namespace Gameplay {
|
|||||||
sf::Clock imguiClock;
|
sf::Clock imguiClock;
|
||||||
music->play();
|
music->play();
|
||||||
while ((not song_finished) and window.isOpen()) {
|
while ((not song_finished) and window.isOpen()) {
|
||||||
|
song_finished = music->getStatus() == sf::Music::Stopped;
|
||||||
ImGui::SFML::Update(window, imguiClock.restart());
|
ImGui::SFML::Update(window, imguiClock.restart());
|
||||||
auto music_time = music->getPlayingOffset();
|
auto music_time = music->getPlayingOffset();
|
||||||
update_note_index(music_time);
|
update_note_index(music_time);
|
||||||
@ -167,6 +171,7 @@ namespace Gameplay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::update_note_index(const sf::Time& music_time) {
|
void Screen::update_note_index(const sf::Time& music_time) {
|
||||||
for (auto i = note_index.load(); i < notes.size(); ++i) {
|
for (auto i = note_index.load(); i < notes.size(); ++i) {
|
||||||
auto note = notes[i].load();
|
auto note = notes[i].load();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user