feat: add runtime play tick and play-mode scene editing semantics

This commit is contained in:
2026-04-02 19:37:35 +08:00
parent e30f5d5ffa
commit fb15d60be9
28 changed files with 2016 additions and 45 deletions

View File

@@ -0,0 +1,45 @@
#pragma once
#include <XCEngine/Scene/SceneRuntime.h>
#include <cstdint>
namespace XCEngine {
namespace Components {
class RuntimeLoop {
public:
struct Settings {
float fixedDeltaTime = 1.0f / 50.0f;
float maxFrameDeltaTime = 0.1f;
uint32_t maxFixedStepsPerFrame = 4;
};
explicit RuntimeLoop(Settings settings = {});
void SetSettings(const Settings& settings);
const Settings& GetSettings() const { return m_settings; }
void Start(Scene* scene);
void Stop();
void Tick(float deltaTime);
void Pause();
void Resume();
void StepFrame();
bool IsRunning() const { return m_sceneRuntime.IsRunning(); }
bool IsPaused() const { return m_paused; }
Scene* GetScene() const { return m_sceneRuntime.GetScene(); }
float GetFixedAccumulator() const { return m_fixedAccumulator; }
private:
SceneRuntime m_sceneRuntime;
Settings m_settings = {};
float m_fixedAccumulator = 0.0f;
bool m_paused = false;
bool m_stepRequested = false;
};
} // namespace Components
} // namespace XCEngine