Code:
void render(void)
{
int letterWidth=48; // the uniform width of each letter block
int letterHeight=48; // the uniform height of each letter block
int destx = 48; // the top-left X coordinate for the first letter
int desty = 96; // the top-left Y coordinate for the first letter
char *message = "HELLO WORLD";
// This variable will hold the pointer to the back buffer
IDirect3DSurface9* backbuffer = NULL;
// Check to make sure you have a valid Direct3D device
if( NULL == pd3dDevice )
return;
// Clear the back buffer to a blue color
pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0,0,255), 1.0f, 0 );
// Retrieve a pointer to the back buffer
pd3dDevice->GetBackBuffer(0,0,D3DBACKBUFFER_TYPE_MONO, &backbuffer);
// Set up a counter variable to hold the letter’s position on the screen
int count=0;
// Loop through the message one character at a time
for ( char *c = message; c != " "; c++ )
{
// source and destination rectangles
RECT src;
RECT dest;
// Set the source rectangle
int srcY = ( ( ( *c - 'A' ) / 6 ) ) * letterHeight;
int srcX = ( ( ( *c - 'A' ) %7 ) * letterWidth );
src.top = srcY ;
src.left = srcX;
src.right = src.left + letterWidth;
src.bottom = src.top + letterHeight;
// Set the dest rectangle
dest.top = desty;
dest.left = destx + ( letterWidth * count );
dest.right = dest.left + letterWidth;
dest.bottom = dest.top + letterHeight;
// Increase the letter count by one
count++;
// Copy this letter to the back buffer
pd3dDevice->StretchRect( srcSurface, // the source surface
src, // the source rectangle
backbuffer, // the destination surface
dest, // destination rectangle
D3DTEXF_NONE); // the filter to apply
}
// Present the back buffer contents to the display
pd3dDevice->Present( NULL, NULL, NULL, NULL );
}
c:\documents and settings\shiju\desktop\projects\spike\loadpartbitm ap\loadpartbitmap\winmain.cpp(121) : error C2440: 'initializing' : cannot convert from 'RECT' to 'const RECT *'
I think StretchRect expect a const pointer. Please help