#define RGB24TO16( r, g, b ) ( ((r) >> 3) << 10) + (((g) >> 3) << 5) + ((b) >> 3) #define RGB15( r, g, b ) ( (r) << 10 ) + ( (g) << 5 ) + (b) #define DEAD 0 #define ALIVE 1 #define Rand(x) (rand()%(x)) // 렌덤 #define BigRand(x) ( rand()*rand()%(x) ) // 렌덤 #define RandRange(min,max) (rand()%(max-min)+min) // 범위렌덤(min이상max미만) #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } #define SAFE_DELETE(x) { if((x) != NULL) { delete (x); (x) = NULL; } } #define SAFE_DELETE_EX(p) { if(p) { delete[] (p); (p)=NULL; } } #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } } #define DWORDBYTES( x ) ( ((x)+3)/4*4 )
#define MAKEUINT64(a, b) ((UINT64) (((UINT32) (a)) | ((UINT64) ((UINT32) (b))) << 32)) #define LOUINT32(l) ((UINT32) (l)) #define HIUINT32(l) ((UINT32) (((UINT64) (l) >> 32) & 0xFFFFFFFF))
#define RED15(p) ( ( (p) >> 10 ) & 0x1F ) #define GREEN15(p) ( ( (p) >> 5 ) & 0x1F ) #define BLUE15(p) ( (p) & 0x1F )
#define RES_STRING( resid ) CString( (LPCTSTR) resid )
template<class T> void swap( T& lhs, T& rhs ) { T temp = lhs; lhs = rhs; rhs = temp; } |
'C & C++ > C & C++' 카테고리의 다른 글
C & C++ 가이드 라인(Guide Line) (0) | 2011.03.27 |
---|---|
RealDeleteFile (0) | 2011.03.27 |
CFile 을 여러 곳에서 오픈 (0) | 2011.03.27 |
CString 대소문자 변경 함수 towlower, towupper, strlwr, strupr (0) | 2011.03.27 |
CString 음수, 양수 부호(+,-)를 포함하여 숫자를 문자열(스트링)로 변환 (0) | 2011.03.27 |
댓글