Restructure repository to include all source folders
Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
71
GameTools/ZALLA3D BASECLASS/FrameTimer.cpp
Normal file
71
GameTools/ZALLA3D BASECLASS/FrameTimer.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
// FrameTimer.cpp: implementation of the CFrameTimer class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "FrameTimer.h"
|
||||
|
||||
std::vector<float> CFrameTimer::m_fUpdateTimeList;
|
||||
std::vector<float> CFrameTimer::m_fTimeRemainList;
|
||||
std::vector<float> CFrameTimer::m_fPerSecondUpdateList;
|
||||
DWORD CFrameTimer::m_dwTickTime;
|
||||
DWORD CFrameTimer::m_dwLastUpdateTime;
|
||||
|
||||
|
||||
CFrameTimer g_FrameTimer;
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// Construction/Destruction
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
CFrameTimer::CFrameTimer()
|
||||
{
|
||||
m_dwTickTime = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
CFrameTimer::~CFrameTimer()
|
||||
{
|
||||
}
|
||||
|
||||
void CFrameTimer::Create()
|
||||
{
|
||||
m_dwTickTime = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
void CFrameTimer::UpdateTime()
|
||||
{
|
||||
if(m_dwTickTime == 0xFFFFFFFF)
|
||||
{
|
||||
m_dwTickTime=GetTickCount();
|
||||
m_dwLastUpdateTime=m_dwTickTime;
|
||||
}
|
||||
DWORD dwOldTickTime=m_dwTickTime;
|
||||
m_dwTickTime=GetTickCount();
|
||||
|
||||
DWORD dwIntervalPreTime=m_dwTickTime-dwOldTickTime;
|
||||
for(int i=0;i<(int)m_fUpdateTimeList.size();i++)
|
||||
{
|
||||
m_fUpdateTimeList[i]=(float)dwIntervalPreTime/(1000.0f/m_fPerSecondUpdateList[i]);
|
||||
m_fUpdateTimeList[i]+=m_fTimeRemainList[i];
|
||||
m_fTimeRemainList[i]=m_fUpdateTimeList[i]-(int)m_fUpdateTimeList[i];
|
||||
}
|
||||
/*
|
||||
float fUpdateFrameRate=(float)(m_dwTickTime-dwOldTickTime)/(1000.0f/35.0f);
|
||||
return fUpdateFrameRate;
|
||||
*/
|
||||
}
|
||||
|
||||
int CFrameTimer::Regist(float fPerSecondUpdate)
|
||||
{
|
||||
int iNum = 0;
|
||||
|
||||
m_fUpdateTimeList.push_back(0.0f);
|
||||
m_fTimeRemainList.push_back(0.0f);
|
||||
m_fPerSecondUpdateList.push_back(fPerSecondUpdate);
|
||||
iNum = (int)m_fUpdateTimeList.size() - 1;
|
||||
return iNum;
|
||||
}
|
||||
|
||||
float CFrameTimer::GetUpdateTimer(int nTimer)
|
||||
{
|
||||
//return 0.0f;
|
||||
return m_fUpdateTimeList[nTimer];
|
||||
}
|
||||
Reference in New Issue
Block a user