Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,850 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,347 people online right now. Registration is fast and FREE... Join Now!




Timer loops

 
Reply to this topicStart new topic

Timer loops

OBL
5 Feb, 2007 - 08:43 PM
Post #1

New D.I.C Head
*

Joined: 5 Feb, 2007
Posts: 1


My Contributions
hey, i need to integrate a timer in this game that i'm making. obviously, i could just use a for loop, but how do I keep the for loop running in the background, while the user plays the game?
i'm not sure which segment of my code i'd have to paste, for the effort thing, cuz i'll have to paste the entire game..
User is offlineProfile CardPM
+Quote Post

AmitTheInfinity
RE: Timer Loops
5 Feb, 2007 - 10:12 PM
Post #2

C Surfing ∞
Group Icon

Joined: 25 Jan, 2007
Posts: 1,156



Thanked: 44 times
Dream Kudos: 125
My Contributions
QUOTE(OBL @ 5 Feb, 2007 - 09:43 PM) *

hey, i need to integrate a timer in this game that i'm making. obviously, i could just use a for loop, but how do I keep the for loop running in the background, while the user plays the game?
i'm not sure which segment of my code i'd have to paste, for the effort thing, cuz i'll have to paste the entire game..


are you in C or C++.
well you can try things on time_t or time.h
have a look here...

http://www.cplusplus.com/reference/clibrary/ctime/
http://www.java2s.com/Code/C/Development/Time-Date.htm

and to generate delays you can use threads, though it's not the only solution hope this will help you
User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 10:23AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month