16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 11:19:19 +02:00

refactored mouse input processor, tweaks to mouse input support, fix for diesel engine compressor, added progress bar label

This commit is contained in:
tmj-fstate
2017-07-10 19:36:23 +02:00
parent 9a008ecff5
commit 16718d53bb
15 changed files with 520 additions and 343 deletions

View File

@@ -152,17 +152,19 @@ double TGauge::GetValue() const {
void TGauge::Update() {
float dt = Timer::GetDeltaTime();
if( ( fFriction > 0 ) && ( dt < 0.5 * fFriction ) ) {
// McZapkie-281102: zabezpieczenie przed oscylacjami dla dlugich czasow
fValue += dt * ( fDesiredValue - fValue ) / fFriction;
}
else {
fValue = fDesiredValue;
}
if( std::abs( fDesiredValue - fValue ) <= 0.001 ) {
// close enough, we can stop updating the model
fValue = fDesiredValue; // set it exactly as requested just in case it matters
if( fValue != fDesiredValue ) {
float dt = Timer::GetDeltaTime();
if( ( fFriction > 0 ) && ( dt < 0.5 * fFriction ) ) {
// McZapkie-281102: zabezpieczenie przed oscylacjami dla dlugich czasow
fValue += dt * ( fDesiredValue - fValue ) / fFriction;
if( std::abs( fDesiredValue - fValue ) <= 0.0001 ) {
// close enough, we can stop updating the model
fValue = fDesiredValue; // set it exactly as requested just in case it matters
}
}
else {
fValue = fDesiredValue;
}
}
if( SubModel )
{ // warunek na wszelki wypadek, gdyby się submodel nie podłączył