mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2024-12-05 03:33:27 +01:00
change time factor behaviour to allow editing
This commit is contained in:
parent
8e757af8d1
commit
7912b58108
@ -95,9 +95,8 @@ void OrganizerSceneService::sceneFixedUpdate(Engine&) {
|
||||
|
||||
size_t continuous_counter = 0;
|
||||
|
||||
auto& time_ctx = _scene->ctx_or_set<MM::Components::TimeDelta>(f_delta, delta_factor);
|
||||
time_ctx.tickDelta = f_delta * delta_factor;
|
||||
time_ctx.deltaFactor = delta_factor;
|
||||
auto& time_ctx = _scene->ctx_or_set<MM::Components::TimeDelta>(f_delta, initial_delta_factor);
|
||||
time_ctx.tickDelta = f_delta * time_ctx.deltaFactor;
|
||||
|
||||
// TODO: this while is just cancer
|
||||
while (_accumulator >= static_cast<decltype(_accumulator)>(dt)){
|
||||
|
@ -21,7 +21,7 @@ namespace MM::Services {
|
||||
public:
|
||||
const float f_delta;
|
||||
|
||||
float delta_factor = 1.f;
|
||||
float initial_delta_factor = 1.f;
|
||||
|
||||
public: // service
|
||||
explicit OrganizerSceneService(const float update_delta = 1.f/60.f) : f_delta(update_delta) {}
|
||||
|
@ -60,9 +60,8 @@ void SimpleSceneService::sceneFixedUpdate(Engine&) {
|
||||
|
||||
size_t continuous_counter = 0;
|
||||
|
||||
auto& time_ctx = _scene->ctx_or_set<MM::Components::TimeDelta>(f_delta, delta_factor);
|
||||
time_ctx.tickDelta = f_delta * delta_factor;
|
||||
time_ctx.deltaFactor = delta_factor;
|
||||
auto& time_ctx = _scene->ctx_or_set<MM::Components::TimeDelta>(f_delta, initial_delta_factor);
|
||||
time_ctx.tickDelta = f_delta * time_ctx.deltaFactor;
|
||||
|
||||
// TODO: this is just cancer
|
||||
while (_accumulator >= static_cast<decltype(_accumulator)>(dt)){
|
||||
@ -70,7 +69,7 @@ void SimpleSceneService::sceneFixedUpdate(Engine&) {
|
||||
continuous_counter++;
|
||||
|
||||
::MM::EachSystemInScene(*_scene, [&](::MM::Scene& s, ::MM::System& fn) {
|
||||
fn(s, f_delta * delta_factor);
|
||||
fn(s, time_ctx.tickDelta);
|
||||
});
|
||||
|
||||
TracyPlot("MM::Services::SimpleSceneService::_scene.alive", (int64_t)_scene->alive());
|
||||
|
@ -19,7 +19,7 @@ namespace MM::Services {
|
||||
public:
|
||||
const float f_delta;
|
||||
|
||||
float delta_factor = 1.f;
|
||||
float initial_delta_factor = 1.f;
|
||||
|
||||
public:
|
||||
explicit SimpleSceneService(const float update_delta = 1.f/60.f) : f_delta(update_delta) {}
|
||||
|
Loading…
Reference in New Issue
Block a user