Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / dbTimer help

Author
Message
sonshuma
5
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 9th Dec 2012 08:19
Hey Guys and Gals!

First of all I'm new, I did about an hour of searching to figure out this problem to no avail so if it has been solved previously I apologize. I'm currently doing a final project (Which is a music game) and I'm having some issues with my while look which holds LoopGDK.

What I'm trying to do is capture the time of the computer via dbTimer and add the amount of time of the song selected in one function (yes, there are only two songs ):



then send that value back up process my while loop until startingAmount = dbTimer():



Currently the loop just keeps iterating because the condition seems to be false... and I'm just an overworked college student missing some extremely obvious at this point or is there no way to do what I wanna do?

Thanks in advance to anyone who responds.
Rudolpho
12
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Dec 2012 13:29
dbTimer() returns the current timestamp; thus continously calling finishCondition() will result in startingAmount constantly being set to 331 or 211 seconds into the future.


"Why do programmers get Halloween and Christmas mixed up?"
sonshuma
5
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 9th Dec 2012 18:17
I figured that's what it might have been right after I sent this last night and come to find out I had my debug printouts in the wrong place after your confirmation. Do you have any ideas on how to capture and store the snapshot of time like I'm trying to do? Or am I going to need to use another library? Thanks for the response!
Rudolpho
12
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 9th Dec 2012 22:56
Just from looking at your snippets I would call finishCondition() outside the main loop. If you need to be able to change the songs mid-run, you would call it again right after changing the track. Just make sure that it doesn't appear in a loop.


"Why do programmers get Halloween and Christmas mixed up?"
sonshuma
5
Years of Service
User Offline
Joined: 9th Dec 2012
Location:
Posted: 9th Dec 2012 23:51
Thanks for the help! Everything works like a charm now.

Login to post a reply

Server time is: 2018-11-17 13:58:17
Your offset time is: 2018-11-17 13:58:17