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 / Timers...

Author
Message
Raigne
16
Years of Service
User Offline
Joined: 24th Nov 2007
Location:
Posted: 1st Dec 2007 22:18
I know this is probably the most obvious thing in the world, but I still cant figure it out.
When I use to use SDL it had the SDL_Timer. I was wondering if there is something similar in DGDK. I was wanting something with at least the following functions.
StartTimer() - Start the timer
GetTicks() - Get the current position of the timer in milliseconds.
PauseTimer() - Pause the timer
Stop() - Stop the timer...

I looked through the documentation, and didnt find anything. maybe i just overlooked it. I might be able to use the SDL_Timer with DGDK, but i havent tried it yet. Thank you for any assistance.
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Dec 2007 22:45
You haven't overlooked anything really - DGDK doesn't provide the kind of timer that SDL provides. You have dbTimer() which is simply a wrapper for the GetTickCount() API call.

However, it's easy enough to put together a simple start/pause/unpause class for a timer:


Literally thrown together in about 15 minutes, so it'll need proper testing - it seems to work Ok.

Utility plugins collection and
http://www.matrix1.demon.co.uk for older plug-ins and example code
Raigne
16
Years of Service
User Offline
Joined: 24th Nov 2007
Location:
Posted: 1st Dec 2007 22:48
Okay thank you very much. I needed it to be able to display my sprites correctly, and for other things like floating text.
FERSIS
18
Years of Service
User Offline
Joined: 17th May 2006
Location:
Posted: 10th Dec 2007 18:52
I have done a timer very similar to yours .But i use float's instead of dwords`
Thanks IanM.

Login to post a reply

Server time is: 2024-11-17 00:14:50
Your offset time is: 2024-11-17 00:14:50