DirectX.inl
资源名称:DXGuide.zip [点击查看]
上传用户:wymy58
上传日期:2007-01-07
资源大小:2086k
文件大小:2k
源码类别:
DirextX编程
开发平台:
Visual C++
- // Copyright (C) 1999 DXGuide. All Rights Reserved.
- // File: DirectX.inl
- // Inlines for CDirectX
- #ifdef _LOG_HTML
- inline void CDirectX::SetLog(bool bLog)
- {
- m_bLog = bLog;
- }
- #endif // _LOG_HTML
- inline CDirectDraw* CDirectX::GetDirectDraw(void)
- {
- return m_pDirectDraw;
- }
- inline CDirectSound* CDirectX::GetDirectSound(void)
- {
- return m_pDirectSound;
- }
- inline CDirectMusic* CDirectX::GetDirectMusic(void)
- {
- return m_pDirectMusic;
- }
- inline CDirectInput* CDirectX::GetDirectInput(void)
- {
- return m_pDirectInput;
- }
- inline CDXGUIManager* CDirectX::GetDXGUIManager(void)
- {
- return m_pDXGUIManager;
- }
- inline D3DCOLOR CDirectX::COLORREF_2_D3DCOLOR(COLORREF clrref)
- {
- /* D3DVALUE r = D3DVALUE(GetRValue(cref)) / D3DVALUE(255);
- D3DVALUE g = D3DVALUE(GetGValue(cref)) / D3DVALUE(255);
- D3DVALUE b = D3DVALUE(GetBValue(cref)) / D3DVALUE(255);
- return D3DRMCreateColorRGB(r, g, b);*/
- return clrref | 0xFF000000L;
- }
- inline COLORREF CDirectX::D3DCOLOR_2_COLORREF(D3DCOLOR d3dclr)
- {
- /* D3DVALUE red = D3DVALUE(255) * D3DRMColorGetRed(d3dclr);
- D3DVALUE green = D3DVALUE(255) * D3DRMColorGetGreen(d3dclr);
- D3DVALUE blue = D3DVALUE(255)* D3DRMColorGetBlue(d3dclr);
- return RGB((int)red, (int)green, (int)blue);*/
- return d3dclr & 0x00FFFFFFL;
- }
- inline float CDirectX::rnd(void)
- {
- return float(rand()) / RAND_MAX;
- }
- inline float CDirectX::GetCosineValue(int nDegree)
- {
- return GetSineValue(90 - nDegree);
- }
- inline bool CDirectX::IsZero(FLOAT a, FLOAT fTol)
- {
- return (a <= 0.0f) ? (a >= -fTol) : (a <= fTol);
- }
- inline DWORD CDirectX::FLOAT2DWORD(FLOAT f)
- {
- union
- {
- FLOAT f;
- DWORD dw;
- } val;
- val.f = f;
- return val.dw;
- }