the whole game

This commit is contained in:
Kolyah35
2026-03-02 22:04:18 +03:00
parent 816e9060b4
commit f0617a5d22
2069 changed files with 581500 additions and 0 deletions

37
src/util/SmoothFloat.h Executable file
View File

@@ -0,0 +1,37 @@
#ifndef UTIL__SmoothFloat_H__
#define UTIL__SmoothFloat_H__
//package util;
class SmoothFloat
{
float targetValue;
float remainingValue;
float lastAmount;
public:
SmoothFloat()
: targetValue(0),
remainingValue(0),
lastAmount(0)
{}
float getNewDeltaValue(float deltaValue, float accelerationAmount) {
targetValue += deltaValue;
deltaValue = (targetValue - remainingValue) * accelerationAmount;
lastAmount = lastAmount + (deltaValue - lastAmount) * .5f;
if ((deltaValue > 0 && deltaValue > lastAmount) || (deltaValue < 0 && deltaValue < lastAmount)) {
deltaValue = lastAmount;
}
remainingValue += deltaValue;
return deltaValue;
}
float getTargetValue() {
return targetValue;
}
};
#endif /*UTIL__SmoothFloat_H__*/