Author Topic: Showing coutdown? using getms?  (Read 2665 times)

Micboy

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-2
    • View Profile
Showing coutdown? using getms?
« on: January 23, 2013, 02:41:02 pm »
Hello,

So Im just wondering: TimerGetMs();
Returns the number of milliseconds elapsed since some point of time in the past, but from which point?

So if I were to design a countdown, should I call TimerGetMsExpired(); twice, then call printf("Milliseconds since last call: %d\n",ms); to print this value on screen. Or should I use textAdd()?
Should I then have an alert box which prevents player from continuing with game?

Thank you for the help!
Micboy

EricB

  • Jr. Member
  • **
  • Posts: 61
  • Karma: +1/-0
    • View Profile
Re: Showing coutdown? using getms?
« Reply #1 on: January 23, 2013, 04:02:12 pm »
You could call TimerGetMsExpired and set it equal to a variable (say timex) the next time you call TimerGetExpired you would add that to variable (timex) so you keep incrementing the time. You cannot use printf in your code as this only works in the simulator not on the device. You would use TextAdd() first then TextSetText() when you want to update the time. Not sure what you mean by an alert box in you game but you could do whatever you wanted when (timex) is a certain value. I wrote a game that just ends after 60 seconds.
Hope this helps.

EricB

ciuffolo

  • Guest
Re: Showing coutdown? using getms?
« Reply #2 on: January 23, 2013, 04:07:40 pm »
I think it like EricB.
M... (sorry but I love triple dots)
Quote
Returns the number of milliseconds elapsed since some point of time in the past, but from which point?
I think that returns the milliseconds elapsed since the start of the application.
Printf isn't the best way to show a countdown...do it with TextAdd.
I have alredy sent you a mp.
The alert box is documented here:
http://dragonfiresdk.net/forum/index.php?topic=74.0
tell me if I realized something wrong.

Hope this helped.