This topic is now archived and is closed to further replies.


DirectDraw text wrapping

Recommended Posts

Hello, I''m a beginner with DirectX programming, and I need some help with text output. Here is my problem: I have my game screen, and I want to output text in a specified rectangular area. I''d like the text to have any length, and so the text should wrap when it''s too large to be on only one line. I somehow figured out a way with the DrawTextEx function. With flags like : DT_WORDBREAK|DT_END_ELLIPSIS|DT_MODIFYSTRING I get what I need, except for one thing... the text outputs nicely, but the rest of the surface is all messed up with weird green or pink lines, like when my monitor is mad about me... You can check the result here : You can see the limit of the surface... I tried to first fill the surface with a black background, with this : DDBLTFX ddbltfx; ZeroMemory(&ddbltfx, sizeof(ddbltfx)); ddbltfx.dwSize = sizeof(DDBLTFX); ddbltfx.dwFillColor = RGB(50, 60, 0); Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx); but it doesn''t seem to do anything ! I thought maybe the DrawTextEx function fill all of the given rectangular area : it writes text and then fill the rest with junk data ? Please help me, I''d like to have a nice wrapped text output, but I can''t use Direct3D our OpenGL... as I''m using only directDraw. Any idea, source piece, or whatever would be appreciated. Thanks Tehem

Share this post

Link to post
Share on other sites