Guest User

Untitled

a guest
May 24th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. class CImageDrawer
  2. {
  3. public:
  4. CImageDrawer( void )
  5. {
  6. memset( this, 0, sizeof( CImageDrawer ) );
  7. }
  8.  
  9. void LoadImage( const char* pszImagePath )
  10. {
  11. strcpy( m_szImagePath, pszImagePath );
  12. }
  13.  
  14. void render( IDirect3DDevice9* pDevice )
  15. {
  16. if ( m_pSurface == NULL )
  17. {
  18. if ( FAILED( D3DXLoadSurfaceFromFile( m_pSurface, NULL, NULL, m_szImagePath, NULL, D3DX_DEFAULT, 0, NULL ) ) )
  19. m_pSurface = NULL;
  20.  
  21. return;
  22. }
  23.  
  24. if ( FAILED( pDevice->GetBackBuffer( 0, 0, D3DBACKBUFFER_TYPE_MONO, &m_pBackBuffer ) ) )
  25. {
  26. return;
  27. }
  28. pDevice->StretchRect( m_pSurface, NULL, m_pBackBuffer, NULL, D3DTEXF_NONE );
  29. }
  30. private:
  31. IDirect3DSurface9* m_pSurface;
  32. IDirect3DSurface9* m_pBackBuffer;
  33. char m_szImagePath[ MAX_PATH ];
  34. };
Add Comment
Please, Sign In to add comment