mirror of
https://github.com/MadeOfJelly/MushMachine.git
synced 2025-04-19 17:52:57 +02: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;
|
size_t continuous_counter = 0;
|
||||||
|
|
||||||
auto& time_ctx = _scene->ctx_or_set<MM::Components::TimeDelta>(f_delta, delta_factor);
|
auto& time_ctx = _scene->ctx_or_set<MM::Components::TimeDelta>(f_delta, initial_delta_factor);
|
||||||
time_ctx.tickDelta = f_delta * delta_factor;
|
time_ctx.tickDelta = f_delta * time_ctx.deltaFactor;
|
||||||
time_ctx.deltaFactor = delta_factor;
|
|
||||||
|
|
||||||
// TODO: this while is just cancer
|
// TODO: this while is just cancer
|
||||||
while (_accumulator >= static_cast<decltype(_accumulator)>(dt)){
|
while (_accumulator >= static_cast<decltype(_accumulator)>(dt)){
|
||||||
|
@ -21,7 +21,7 @@ namespace MM::Services {
|
|||||||
public:
|
public:
|
||||||
const float f_delta;
|
const float f_delta;
|
||||||
|
|
||||||
float delta_factor = 1.f;
|
float initial_delta_factor = 1.f;
|
||||||
|
|
||||||
public: // service
|
public: // service
|
||||||
explicit OrganizerSceneService(const float update_delta = 1.f/60.f) : f_delta(update_delta) {}
|
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;
|
size_t continuous_counter = 0;
|
||||||
|
|
||||||
auto& time_ctx = _scene->ctx_or_set<MM::Components::TimeDelta>(f_delta, delta_factor);
|
auto& time_ctx = _scene->ctx_or_set<MM::Components::TimeDelta>(f_delta, initial_delta_factor);
|
||||||
time_ctx.tickDelta = f_delta * delta_factor;
|
time_ctx.tickDelta = f_delta * time_ctx.deltaFactor;
|
||||||
time_ctx.deltaFactor = delta_factor;
|
|
||||||
|
|
||||||
// TODO: this is just cancer
|
// TODO: this is just cancer
|
||||||
while (_accumulator >= static_cast<decltype(_accumulator)>(dt)){
|
while (_accumulator >= static_cast<decltype(_accumulator)>(dt)){
|
||||||
@ -70,7 +69,7 @@ void SimpleSceneService::sceneFixedUpdate(Engine&) {
|
|||||||
continuous_counter++;
|
continuous_counter++;
|
||||||
|
|
||||||
::MM::EachSystemInScene(*_scene, [&](::MM::Scene& s, ::MM::System& fn) {
|
::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());
|
TracyPlot("MM::Services::SimpleSceneService::_scene.alive", (int64_t)_scene->alive());
|
||||||
|
@ -19,7 +19,7 @@ namespace MM::Services {
|
|||||||
public:
|
public:
|
||||||
const float f_delta;
|
const float f_delta;
|
||||||
|
|
||||||
float delta_factor = 1.f;
|
float initial_delta_factor = 1.f;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SimpleSceneService(const float update_delta = 1.f/60.f) : f_delta(update_delta) {}
|
explicit SimpleSceneService(const float update_delta = 1.f/60.f) : f_delta(update_delta) {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user