Skip to content

Commit e85d7ac

Browse files
committed
[WIP] fix: when scene is paused is must be possible to stop it
1 parent ede0ecc commit e85d7ac

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/App/Entrypoint.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ int main(void) {
6161
renderer.WaitIdle(t);
6262
}
6363

64-
if (scene.IsRunning()) scene.Stop();
64+
if (scene.IsRunning() or scene.IsPaused()) scene.Stop();
6565

6666
app->Stop(scene);
6767
delete app;

src/Renderer/EditorLayer.cc

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ namespace volt::renderer {
3535
void EditorLayer::drawControls(runtime::Scene &s) noexcept {
3636
if (ImGui::Begin("Controls", nullptr, ImGuiWindowFlags_NoTitleBar)) {
3737
if (s.IsRunning()) {
38-
if (ImGui::Button("Pause")) {
39-
s.Pause();
40-
}
38+
if (ImGui::Button("Pause")) s.Pause();
4139
ImGui::SameLine();
42-
if (ImGui::Button("Stop")) {
43-
s.Stop();
44-
}
40+
if (ImGui::Button("Stop")) s.Stop();
4541
}
46-
else if (ImGui::Button("Play")) {
47-
s.Play();
42+
else if (s.IsPaused()) {
43+
if (ImGui::Button("Play")) s.Play();
44+
ImGui::SameLine();
45+
if (ImGui::Button("Stop")) s.Stop();
4846
}
47+
else if (ImGui::Button("Play")) s.Play();
4948
}
5049
ImGui::End();
5150
}

src/Runtime/Scene.hh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ namespace volt::runtime {
6060
std::optional<Entity> FindEntityByID(core::SnowflakeID::value_type id);
6161
std::optional<Entity> FindEntityByName(const std::string &name);
6262
inline bool IsRunning(void) const noexcept { return m_running; }
63+
inline bool IsPaused(void) const noexcept { return m_paused; }
6364
void Play(void) noexcept;
6465
void Pause(void) noexcept;
6566
void Stop(void) noexcept;

0 commit comments

Comments
 (0)