31 #ifndef CRAB_GAMECLOCK_H 32 #define CRAB_GAMECLOCK_H 34 #include "crab/numstr.h" 35 #include "crab/timer.h" 45 GameClock() : _seperator(
" : ") { _start = 0; }
47 void start(uint32 initialTime = 0) {
53 uint32 ms = 0, hr = 0, min = 0, sec = 0;
57 if (found1 > 0 && found1 != Common::String::npos) {
58 strHrs = str.
substr(0, found1);
59 hr = stringToNumber<uint32>(strHrs);
62 if (found2 > 0 && found2 != Common::String::npos) {
63 strSec = str.
substr(found2 + 1, Common::String::npos);
64 sec = stringToNumber<uint32>(strSec);
66 strMin = str.
substr(found1 + _seperator.size(), found2 - (2 * _seperator.size()));
67 min = stringToNumber<uint32>(strMin);
71 ms = 3600000 * hr + 60000 * min + 1000 * sec;
76 uint32 ms = _start + _timer.ticks();
79 uint32 seconds = x % 60;
81 uint32 minutes = x % 60;
82 uint32 hours = x / 60;
85 timeStr += _seperator;
86 timeStr += numberToString(minutes);
87 timeStr += _seperator;
88 timeStr += numberToString(seconds);
96 #endif // CRAB_GAMECLOCK_H
size_t findFirstOf(value_type c, size_t pos=0) const
String substr(size_t pos=0, size_t len=npos) const
Definition: moveeffect.h:37
Definition: GameClock.h:39