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

📄 custom_time.cpp.svn-base

📁 自己做的小游戏
💻 SVN-BASE
字号:
#include <windows.h>
#include "custom_time.h"




unsigned int preT, curT, incT;

//SYSTEMTIME st;
//SYSTEMTIME sysT;


void InitTime()
{
	preT = curT = timeGetTime();
	incT = curT - preT;
}


//标记每一帧的时间戳,在每一帧的更新开始时调用
void MarkTimeThisTick()
{
	curT = timeGetTime();
	incT = curT - preT;
	//GetSystemTime(&st);
	//if (st.wSecond != sysT.wSecond)	//跨越了一秒
	//	curTime += (1000 + st.wMilliseconds - sysT.wMilliseconds);
	//else
	//	curTime += (st.wMilliseconds - sysT.wMilliseconds);
	//sysT.wSecond = st.wSecond;
	//sysT.wMilliseconds = st.wMilliseconds;
}


//在每一帧更新的结束时调用
void MarkTimeThisTick2()
{
	preT = curT;
}


unsigned long  GetCurTime()
{	
	return curT;
}

⌨️ 快捷键说明

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