countertimer.cpp

来自「足球机器人仿真组SimuroSot11vs11的源程序。」· C++ 代码 · 共 52 行

CPP
52
字号
// CounterTimer.cpp: implementation of the CCounterTimer class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "CounterTimer.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CCounterTimer::CCounterTimer()
: m_nCount(0), m_bRunning(FALSE)
{

}

CCounterTimer::~CCounterTimer()
{

}

void CCounterTimer::Start(UINT nCount)
{
	m_bRunning = TRUE;
	m_nCount = nCount;
}


void CCounterTimer::Stop()
{
	m_bRunning = FALSE;
	m_nCount = 0;
}

void CCounterTimer::Step()
{
	if (!m_bRunning || m_nCount == 0)
		return;

	m_nCount--;
	if (m_nCount == 0)
	{
		m_pListener->Update(this);
	}
}

void CCounterTimer::AttachListener(CCounterTimerListener* pListener)
{
	m_pListener = pListener;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?