Could somebody please help me with a problem regarding tutorial 17 in beginner c++ series.
I attempted to make a Time struct and made a float variable to store the deltaTime. I also made a function to update the deltaTime which runs inside the UpdateModel in Game.cpp . However, the deltaTime seems to give very high values. Could somebody please take a look and give a hint of what I could be doing wrong.
I have uploaded the header file in this link:
https://github.com/tarunChand28298/QuestionOnChrono.git
Problem on Beginner-Tutorial17 (Chrono)
-
- Posts: 2
- Joined: January 14th, 2019, 7:10 pm
-
- Posts: 432
- Joined: September 26th, 2013, 4:57 pm
- Location: Kentucky
- Contact:
Re: Problem on Beginner-Tutorial17 (Chrono)
You are not assigning present time before doing the calculation.
Line 16 should be the first line of CalculateDeltaTime()
Line 16 should be the first line of CalculateDeltaTime()
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.
-
- Posts: 2
- Joined: January 14th, 2019, 7:10 pm
Re: Problem on Beginner-Tutorial17 (Chrono)
Thanks man! That seems to work.
And, by the way, there was one other thing int the code which was causing the problem.
I was supposed to use std::chrono::duration<float> but I was using std::chrono::steady_clock::duration.
I did not expect somebody to help this fast. Thanks again man!
And, by the way, there was one other thing int the code which was causing the problem.
I was supposed to use std::chrono::duration<float> but I was using std::chrono::steady_clock::duration.
I did not expect somebody to help this fast. Thanks again man!
-
- Posts: 4373
- Joined: February 28th, 2013, 3:23 am
- Location: Oklahoma, United States
Re: Problem on Beginner-Tutorial17 (Chrono)
There may not be a lot of chatter in the forum, but there are usually people prowling around. Most are probably on/in the discord.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com