Original Post
Hello everyone. I have created a font engine using bitmaps in DirectX because GDI is slow. The engine works; however, it is even slower than using the GDI method! Here is the code that does the blitting. The characters are loaded in an array of surfaces called text_buffer[191];
///this function uses DirectX to blit text to the screen////////
void BlitText(char *text, int x, int y, LPDIRECTDRAWSURFACE4 lpdds)
{
RECT dest_rect, // the destination rectangle
source_rect; // the source rectangle
dest_rect.top = y;
dest_rect.bottom = y+12;
// fill in the source rect
source_rect.left = 0;
source_rect.top = 0;
source_rect.right = 12;
source_rect.bottom = 12;
for ( int index=0 ; text[index] != NULL; index++)
{
dest_rect.left = x + (11 * index);
dest_rect.right = x + (11 * index) + 12;
lpdds->Blt(&dest_rect, text_buffer[text[index] - 32], &source_rect,(DDBLT_WAIT | DDBLT_KEYSRC), NULL); // blit
} // end for
} // end BlitText
Thanks for your help.