Link del tempo all'aggiornamento dei dati
This commit is contained in:
Binary file not shown.
@@ -81,7 +81,7 @@ void Lower_Body::update(sf::Clock cl, float multiplier){
|
|||||||
float dxAcc = dx->getZ_Acc() ;
|
float dxAcc = dx->getZ_Acc() ;
|
||||||
|
|
||||||
int64_t Dtime = cl.getElapsedTime().asMicroseconds();
|
int64_t Dtime = cl.getElapsedTime().asMicroseconds();
|
||||||
if (prevT == 0) prevT = Dtime;
|
if (prevT == 0) prevT >= Dtime;
|
||||||
float dt = (float(Dtime) / 1000000.0) - (float(prevT) / 1000000.0);
|
float dt = (float(Dtime) / 1000000.0) - (float(prevT) / 1000000.0);
|
||||||
prevT = Dtime;
|
prevT = Dtime;
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void rigidbody::calcPos(const float Dtime){
|
|||||||
|
|
||||||
void rigidbody::step(const sf::Clock time, float multiplier){
|
void rigidbody::step(const sf::Clock time, float multiplier){
|
||||||
int64_t Dtime = time.getElapsedTime().asMicroseconds();
|
int64_t Dtime = time.getElapsedTime().asMicroseconds();
|
||||||
if (prevT == 0) prevT = Dtime;
|
if (prevT == 0) prevT >= Dtime;
|
||||||
|
|
||||||
|
|
||||||
float dt = ((float(Dtime) / 1000000.0) - (float(prevT) / 1000000.0)) * multiplier;
|
float dt = ((float(Dtime) / 1000000.0) - (float(prevT) / 1000000.0)) * multiplier;
|
||||||
|
|||||||
+1
-1
@@ -106,7 +106,7 @@ int main() {
|
|||||||
sf::Clock mainClock;
|
sf::Clock mainClock;
|
||||||
while (gs.window.isOpen())
|
while (gs.window.isOpen())
|
||||||
{
|
{
|
||||||
curTime += mainClock.restart().asMilliseconds();
|
curTime += mainClock.restart().asMilliseconds() *(*gs.tMul) ;
|
||||||
if (curTime > T){
|
if (curTime > T){
|
||||||
if (gs.play && pos+curTime/T < maj) pos += curTime / T;
|
if (gs.play && pos+curTime/T < maj) pos += curTime / T;
|
||||||
curTime = 0;
|
curTime = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user