the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 29 lines 654 B view raw
1#include "stdafx.h" 2#include "SmoothFloat.h" 3 4SmoothFloat::SmoothFloat() 5{ 6 targetValue = 0.0f; 7 remainingValue = 0.0f; 8 lastAmount = 0.0f; 9} 10 11float SmoothFloat::getNewDeltaValue(float deltaValue, float accelerationAmount) 12{ 13 targetValue += deltaValue; 14 15 deltaValue = (targetValue - remainingValue) * accelerationAmount; 16 lastAmount = lastAmount + (deltaValue - lastAmount) * 0.5f; 17 if ((deltaValue > 0 && deltaValue > lastAmount) || (deltaValue < 0 && deltaValue < lastAmount)) 18 { 19 deltaValue = lastAmount; 20 } 21 remainingValue += deltaValue; 22 23 return deltaValue; 24} 25 26float SmoothFloat::getTargetValue() 27{ 28 return targetValue; 29}