Change: make for smooth-scrolling based on actual time

This means if rendering takes a bit longer, scrolling goes a bit
quicker, making travel time always about the same time for the
same distance.
This commit is contained in:
Patric Stout
2024-01-22 16:45:00 +01:00
committed by Patric Stout
parent cbb24b5d71
commit ea8c1d8597
5 changed files with 61 additions and 29 deletions

View File

@@ -350,23 +350,6 @@ constexpr int RoundDivSU(int a, uint b)
}
}
/**
* Computes (a / b) rounded away from zero.
* @param a Numerator
* @param b Denominator
* @return Quotient, rounded away from zero
*/
constexpr int DivAwayFromZero(int a, uint b)
{
const int _b = static_cast<int>(b);
if (a > 0) {
return (a + _b - 1) / _b;
} else {
/* Note: Behaviour of negative numerator division is truncation toward zero. */
return (a - _b + 1) / _b;
}
}
uint32_t IntSqrt(uint32_t num);
#endif /* MATH_FUNC_HPP */