DragonNest/Common/EngineUtil/EngineUtil.cpp
2024-12-20 16:56:44 +08:00

37 lines
1.4 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "StdAfx.h"
#include "EngineUtil.h"
#ifdef _DEBUG
#define new new(_NORMAL_BLOCK,__FILE__,__LINE__)
#endif
EtVector2 EtVec3toVec2( EtVector3 &vVec )
{
return EtVector2( vVec.x, vVec.z );
}
EtVector3 EtVec2toVec3( EtVector2 &vVec )
{
return EtVector3( vVec.x, 0.f, vVec.y );
}
bool CheckRect( float x, float y, EtVector2 &VecMin, EtVector2 &VecMax )
{
if( x >= VecMin.x && x <= VecMax.x && y >= VecMin.y && y <= VecMax.y ) return true;
return false;
}
float RandomNumberInRange( float fMin, float fMax )
{
float fRange, fRandom;
fRandom = float( ::rand() ) / float( RAND_MAX );
fRange = fMax - fMin;
fRandom *= fRange;
fRandom += fMin;
return fRandom;
}