Yake - Community Forum
September 09, 2010, 04:32:07 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: News #2: Feel free to pester the members of the Community Support! Look out for blue stars! Smiley
 
   Home   Help Search Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: beginner question: how can i use the yake::timer class? [solved using boost]  (Read 1649 times)
SZ
Newbie
*
Posts: 1


View Profile
« on: August 16, 2008, 11:40:07 PM »

Hi
I just got a silly question. I want to use a timer to measure how long a key is pressed.
I am using vc++ 2005 express and have tried this code
Code:
yake::Timer* anyname;
anyname->getSeconds();
I can compile the code but i can't get it to work. Can someone give a sample of how to use the timer?

Thanks in advance
SZ


Solution:
Since i have seen that the yake::timer class is just an interface i have used the timer of boost. (I'm liking boost more and more)
Code:
//One more include in my header file.
#include <boost/timer.hpp>
//the boost timer is used like any other variable type
boost::timer anyname;

//onkeydown restart the timer
anyname.restart();

//onkeyup show elapsed time //returns time as double
anyname.elapsed();
« Last Edit: August 21, 2008, 07:26:18 PM by SZ » Logged
psyclonist
Administrator
Hero Member
*****
Gender: Male
Posts: 2811



View Profile WWW
« Reply #1 on: September 15, 2008, 05:50:36 PM »

(I'm liking boost more and more)
That's good! Smiley
Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.071 seconds with 19 queries.