Original Post
I have writting this thing so many times I can''t believe I still can''t remember how to do it.
What I''m trying to do is make a font engine that takes the ASCII code of a character and matches that to a bitmap containing the character set and then blitting the proper letter or number onto the screen.
The bitmap is set up in a 16 X 16 grid of characters.
Heres the code I''m trying to use:
for (unsigned int count = 0;count < strlen(text); count++)
{
SourceRect.left = text[count] & 15 * 15;
SourceRect.top = text[count] / 15 * 11;
SourceRect.right = SourceRect.left + 15;
SourceRect.bottom = SourceRect.top + 11;
if FAILED(hr = Display->Blt(x + count * 10, y,FontSurface,&SourceRect))
WriteLog("Could not blit! Error: %d",hr);
}
"text" contains the string I''m trying to blit. I''m also using the DDUtil.cpp stuff...not straight DirectDraw.
Each letter is about 15 X 11.
When I use this code i just get jibberish instead of the right text. What''s wrong?!