⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 msectimer.cpp

📁 c+++ game uploading now
💻 CPP
字号:
/**
 @file
 Code for a timer with a resolution of one milisecond.
*/
#include "MSecTimer.h"
#include "../lib/WinException.h"

using namespace Othello;

MSecTimer::MSecTimer()
{
    LARGE_INTEGER freq=_htimer.Frequency();
    if(freq.QuadPart<1000)
        throw Win::Exception("Hardware does not support a timer with resolution of atleast 1 ms");
}

unsigned int MSecTimer::Time()
{
    LARGE_INTEGER ticks=_htimer.Ticks();
    LARGE_INTEGER freq=_htimer.Frequency();
    return static_cast<unsigned int>(1000*(ticks.QuadPart/freq.QuadPart))+1;
}

void MSecTimer::ReInit()
{
    _htimer.InitBase();
}

⌨️ 快捷键说明

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