Thread: Proper use of duo timers.......

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    57

    Proper use of duo timers.......

    Just asking if this is the proper way to do it. I haven't tested it out yet(too much work). *cough* Here it goes........

    Code:
    const int ID_TIMER= 1;
    const int ID_TIMER2= 2;
    
    WM_CREATE:
     SetTimer(hwnd, ID_TIMER, 100, NULL);
     SetTimer(hwnd, ID_TIMER2, 500, NULL);
     break;
    WM_TIMER:
     {          // Everytime I make a timer I always use brackets, don't ask why
      if(ID_TIMER==wParam) {
      DoThis(); }
      if(ID_TIMER2==wParam) {
      DoSomethingElse(); }
     }
     break;
    "A Programmer being told to 'go to' hell sees the 'go to' part of the sentence as the worst part." - Master Foto

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    don't forget to KillTimer() at some point. and why do you feel the need to comment the use of brackets there? It's not abnormal to use brackets in a case.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    57
    I know that I have to kill both timers. Also, some people on these forums are a little picky. I was just trying to avoid bashing ya' know. Didn't want someone to reply to the post saying, "Only idiots use brackets" or anything like that. I don't know why some programmers say things like that.

    Anyways, I hope this duo timer thing works in my game.
    "A Programmer being told to 'go to' hell sees the 'go to' part of the sentence as the worst part." - Master Foto

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Threads and Timers
    By scioner in forum C Programming
    Replies: 8
    Last Post: 03-22-2008, 07:56 AM
  2. Making proper wrappers.
    By bladerunner627 in forum C++ Programming
    Replies: 3
    Last Post: 11-02-2005, 05:18 PM
  3. Timers, Timers, Timers!
    By Stan100 in forum Game Programming
    Replies: 9
    Last Post: 01-24-2003, 04:45 PM
  4. How to find the proper divisor?
    By yusiye in forum C Programming
    Replies: 6
    Last Post: 07-24-2002, 01:14 PM
  5. Timers
    By Mox in forum Windows Programming
    Replies: 2
    Last Post: 11-09-2001, 04:34 AM