tidy-fix automàtic (sense naming)

This commit is contained in:
2026-05-14 18:28:23 +02:00
parent 358e91ea30
commit b7a551c158
81 changed files with 1549 additions and 831 deletions
+28 -12
View File
@@ -4,7 +4,7 @@
namespace scenes {
Timeline& Timeline::step(int duration_ms, StepFn fn) {
auto Timeline::step(int duration_ms, StepFn fn) -> Timeline& {
Step s;
s.duration_ms = duration_ms;
s.continuous = std::move(fn);
@@ -12,7 +12,7 @@ namespace scenes {
return *this;
}
Timeline& Timeline::once(OnceFn fn) {
auto Timeline::once(OnceFn fn) -> Timeline& {
Step s;
s.duration_ms = 0;
s.oneshot = std::move(fn);
@@ -25,7 +25,9 @@ namespace scenes {
auto& s = steps_[current_];
if (!s.entered) {
s.entered = true;
if (s.oneshot) s.oneshot();
if (s.oneshot) {
s.oneshot();
}
}
++current_;
elapsed_in_step_ = 0;
@@ -33,21 +35,29 @@ namespace scenes {
}
void Timeline::tick(int delta_ms) {
if (skipped_) return;
if (skipped_) {
return;
}
flushOneShots();
if (current_ >= steps_.size()) return;
if (current_ >= steps_.size()) {
return;
}
auto& s = steps_[current_];
if (!s.entered) {
s.entered = true;
// Primer tick dins del pas: cridem amb progress=0 si hi ha callback.
if (s.continuous) s.continuous(0.0f);
if (s.continuous) {
s.continuous(0.0F);
}
}
elapsed_in_step_ += delta_ms;
if (elapsed_in_step_ >= s.duration_ms) {
// Tancament del pas: una crida final amb progress=1.
if (s.continuous) s.continuous(1.0f);
if (s.continuous) {
s.continuous(1.0F);
}
++current_;
elapsed_in_step_ = 0;
// Pot ser que el següent pas siga una cadena de one-shots.
@@ -65,20 +75,26 @@ namespace scenes {
}
void Timeline::reset() {
for (auto& s : steps_) s.entered = false;
for (auto& s : steps_) {
s.entered = false;
}
current_ = 0;
elapsed_in_step_ = 0;
skipped_ = false;
}
bool Timeline::done() const {
auto Timeline::done() const -> bool {
return skipped_ || current_ >= steps_.size();
}
float Timeline::currentProgress() const {
if (current_ >= steps_.size()) return 1.0f;
auto Timeline::currentProgress() const -> float {
if (current_ >= steps_.size()) {
return 1.0F;
}
const auto& s = steps_[current_];
if (s.duration_ms <= 0) return 0.0f;
if (s.duration_ms <= 0) {
return 0.0F;
}
return static_cast<float>(elapsed_in_step_) / static_cast<float>(s.duration_ms);
}