Original Post
Hey, hi again. I am coming with a new problem: I cannot execute a program. It contains a function (render) defined like this:
VOID Render()
{
IDirect3DSurface9* surface;
IDirect3DSurface9* backbuffer;
int letterWidth=(478/7);
int letterHeight=(478/7);
int destx=48;
int desty=96;
char* message = "hello world";
if (NULL==g_pd3dDevice)
return;
hResult=g_pd3dDevice->CreateOffscreenPlainSurface(640, 480, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &surface, NULL);
if (FAILED(hResult))
return;
hResult=D3DXLoadSurfaceFromFile(surface, NULL, NULL, "alphabet.bmp", NULL, D3DX_DEFAULT, 0, NULL);
if (FAILED(hResult))
return;
//Clear the backbuffer to a blue color
g_pd3dDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(100, 200, 255), 1.0f, 0);
//Get the backbuffer
g_pd3dDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &backbuffer); //Here we get a pointer to the backbuffer surface
//Set up a counter variable to hold the letter position on the screen
int count=0;
//Loop through the message one character 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++;
[color=red]g_pd3dDevice->StretchRect(surface, src, backbuffer, dest, D3DTEXF_NONE);
}
//Present the backbuffer contents to the display
g_pd3dDevice->Present(NULL, NULL, NULL, NULL);
}
When I try to execute the code, I get an error when calling StretchRect method. The error says: error C2664: 'IDirect3DDevice9::StretchRect' : cannot convert from parameter 2 'RECT' to 'const RECT *' I don`t know how to handle this error, and I cannot go on programming without solving this problem... help, please. Thank you! Skinner