//----------------------------------------------------------------------------- // File: DXUtil.h // // Desc: Helper functions and typing shortcuts for DirectX programming. // // Copyright (c) 1997-2001 Microsoft Corporation. All rights reserved //----------------------------------------------------------------------------- #ifndef DXUTIL_H #define DXUTIL_H //----------------------------------------------------------------------------- // UNICODE support for converting between CHAR, TCHAR, and WCHAR strings //----------------------------------------------------------------------------- VOID DXUtil_ConvertAnsiStringToWide( WCHAR* wstrDestination, const CHAR* strSource, int cchDestChar = -1 ); VOID DXUtil_ConvertWideStringToAnsi( CHAR* strDestination, const WCHAR* wstrSource, int cchDestChar = -1 ); VOID DXUtil_ConvertGenericStringToAnsi( CHAR* strDestination, const TCHAR* tstrSource, int cchDestChar = -1 ); VOID DXUtil_ConvertGenericStringToWide( WCHAR* wstrDestination, const TCHAR* tstrSource, int cchDestChar = -1 ); VOID DXUtil_ConvertAnsiStringToGeneric( TCHAR* tstrDestination, const CHAR* strSource, int cchDestChar = -1 ); VOID DXUtil_ConvertWideStringToGeneric( TCHAR* tstrDestination, const WCHAR* wstrSource, int cchDestChar = -1 ); //----------------------------------------------------------------------------- // Miscellaneous helper functions //----------------------------------------------------------------------------- #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } } #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } } #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } //----------------------------------------------------------------------------- // Debug printing support //----------------------------------------------------------------------------- VOID DXUtil_Trace( TCHAR* strMsg, ... ); HRESULT _DbgOut( TCHAR*, DWORD, HRESULT, TCHAR* ); #if defined(DEBUG) | defined(_DEBUG) #define DXTRACE DXUtil_Trace #else #define DXTRACE sizeof #endif #if defined(DEBUG) | defined(_DEBUG) #define DEBUG_MSG(str) _DbgOut( __FILE__, (DWORD)__LINE__, 0, str ) #else #define DEBUG_MSG(str) (0L) #endif #endif // DXUTIL_H