it is a visual c++ file

源代码在线查看: timer.cpp

软件大小: 152 K
上传用户: maple_78
关键词: visual file it is
下载地址: 免注册下载 普通下载 VIP

相关代码

				//////////////////////////////////////////////////////////////////////////////////////////
				//	TIMER.cpp
				//	functions for timer
				//	Downloaded from: www.paulsprojects.net
				//	Created:	20th July 2002
				//
				//	Copyright (c) 2006, Paul Baker
				//	Distributed under the New BSD Licence. (See accompanying file License.txt or copy at
				//	http://www.paulsprojects.net/NewBSDLicense.txt)
				//////////////////////////////////////////////////////////////////////////////////////////	
				#include "TIMER.h"
				
				void TIMER::Reset()
				{
					startTime=(double)timeGetTime();
				}
				
				double TIMER::GetTime()
				{
					if(isPaused)
						return pauseTime-startTime;
					else
						return ((double)timeGetTime())-startTime;
				}
				
				void TIMER::Pause()
				{
					if(isPaused)
						return;		//only pause if unpaused
				
					isPaused=true;
					pauseTime=(double)timeGetTime();
				}
				
				void TIMER::Unpause()
				{
					if(!isPaused)
						return;		//only unpause if paused
				
					isPaused=false;
					startTime+=((double)timeGetTime()-pauseTime);	//update start time to reflect pause
				}			

相关资源