feat: add pauzing of the running game
This commit is contained in:
@@ -55,7 +55,9 @@ public:
|
||||
virtual void onPlayModeChanged(bool) {}
|
||||
|
||||
[[nodiscard]] bool isPlaying() const { return playing; }
|
||||
[[nodiscard]] bool isPaused() const { return paused; }
|
||||
void requestPlayModeToggle() { playModeToggleRequested = true; }
|
||||
void setPaused(bool pause);
|
||||
|
||||
virtual void customWindowsMenu() {}
|
||||
|
||||
@@ -75,7 +77,6 @@ protected:
|
||||
bool cleanedUp{false};
|
||||
bool cleaningUp{false};
|
||||
bool customInitStarted{false};
|
||||
bool gamePaused{false};
|
||||
|
||||
bool frameLimit{false};
|
||||
float frameTime{0.f};
|
||||
@@ -110,6 +111,8 @@ private:
|
||||
void exitPlayMode();
|
||||
|
||||
bool playing{true};
|
||||
bool paused{false};
|
||||
bool mouseCapturedBeforePause{false};
|
||||
bool playModeToggleRequested{false};
|
||||
std::optional<nlohmann::json> editSnapshot;
|
||||
std::weak_ptr<Scene> editScene;
|
||||
|
||||
@@ -20,6 +20,8 @@ public:
|
||||
|
||||
void SetPlaying(bool playing) { m_playing = playing; }
|
||||
[[nodiscard]] bool IsPlaying() const { return m_playing; }
|
||||
void SetPaused(bool paused) { m_paused = paused; }
|
||||
[[nodiscard]] bool IsPaused() const { return m_paused; }
|
||||
|
||||
void Update(float dt);
|
||||
void FixedUpdate(float dt);
|
||||
@@ -55,7 +57,11 @@ private:
|
||||
|
||||
std::vector<std::shared_ptr<Scene>> m_activeScenes;
|
||||
std::vector<std::shared_ptr<Scene>> m_scenes;
|
||||
|
||||
[[nodiscard]] bool IsTicking() const { return m_playing && !m_paused; }
|
||||
|
||||
bool m_playing{true};
|
||||
bool m_paused{false};
|
||||
};
|
||||
|
||||
#endif //SCENEMANAGER_H
|
||||
|
||||
Reference in New Issue
Block a user