Thread: continuously updating timer on console display

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    221

    continuously updating timer on console display

    i need to figure out a way to show a timer on screen that keeps updating every second (heh), and goes all the way to a selected time, then is able to send a message back to terminate the current function or something

    any ideas how to start this?
    (no, i dont want code or anything, but maybe some sites or what functions i need or something, i've tried searching, and nothing's really come up)

    thanks

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    in windows:

    SetTimer(), KillTimer(), WM_TIMER, GetSystemTime()

    you can use GetSystemTime() in a console app also. so if you _sleep() for 1000 msec and GetSystemTime() in a loop you should be able to do the same thing
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    i need to be doing things at the same time as the timer is going on. this is for a game im writing. the timer needs to be updating in the corner, but at the same time, still allow keyboard usage. i dunno if _sleep allows that or not

  4. #4
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    I assume you have a "game loop" then. This is where you can check the timer. The game loop is a place where rendering and input usually is handled. timers can be handled there too
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  5. #5
    Registered User
    Join Date
    Dec 2002
    Posts
    221
    thank you

    one more n00b question
    is there any way to go to a specific location on the console screen? something like gotoxy() with borland?
    im using devc++

  6. #6
    Registered User
    Join Date
    Jan 2002
    Posts
    387
    read the board FAQ
    "There are three kinds of people in the world...
    Those that can count and those that can't."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Updating display on screen?
    By shadow1515 in forum C Programming
    Replies: 2
    Last Post: 06-06-2008, 10:24 AM
  2. updating a label with a timer event
    By luigi40 in forum C# Programming
    Replies: 4
    Last Post: 03-31-2005, 08:19 AM
  3. Console Functions Help
    By Artist_of_dream in forum C++ Programming
    Replies: 9
    Last Post: 12-04-2004, 03:44 AM
  4. How to display arabic/hebrew in console?
    By Jumper in forum Windows Programming
    Replies: 0
    Last Post: 07-19-2004, 01:43 PM
  5. Just one Question?
    By Irish-Slasher in forum C++ Programming
    Replies: 6
    Last Post: 02-12-2002, 10:19 AM