You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers. No questions about C++ programming or topics which are answered in the tutorials!
I'm alittle lazy and not too good with things like this. But I need to use the ITimer to find the minutes and seconds thats passed since I last reset it. But, I get these outrages differences when I change on digit . Like
if(Time >= 3000) //Millisecs
{
. . . .
}
If I change that to 4000 the time doesnt' change at all. . . . Could someone paste some code for a timer?
Programmer of the Irrlicht Scene Editor: Homepage - Forum Thread
Version 2 on its way!!
//1000ms = 1 second
//60sec = 1 minute
//60000ms = 1 minute
void getTimeSince(u32 time, u32 & minutes, u32 & seconds) {
u32 currTime = ITimer->getTime()
u32 delta = currTime - time;
// delta = minutes * 60000 + seconds * 1000 + ms
//get num ms left that dont make up a minute ( afterMinutes = seconds * 1000 + ms )
u32 afterMinutes = delta % 60000;
minutes = (delta-afterMinutes)/60000;
//get num ms left that dont make up a second ( afterseconds = ms )
u32 afterSeconds = afterMinutes % 1000;
seconds = (delta - minutes*60000 - afterSeconds) / 1000;
}
modulus isnt the fastest thing to use-- i wonder if anyone knows a faster way?
oh, and it still uses ms, so i just multiply the seconds by 1000 when i pass it the time to set for. it wouldnt be too hard to just add another version of the set func that does that part for ya tho.
-Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net