Advertisement

DirectDraw DrawText

Started by August 12, 2000 12:42 AM
12 comments, last by vbisme 24 years, 4 months ago
Well, actually that''s the GDI way. If you don''t want to use it you got to create a sort of tiling engine which draws a text by drawing a picture for each character beneath the other.
For further information have a look at http://www.gamedev.net/reference/programming/features/fontengine

That''d help you.

hth
pi~
Jan PieczkowskiBrainwave Studios
Enix (or someone who knows):

the GDI way, how do you set the text color and the color behind the text?
Advertisement
to set the background color of the text you can use:
COLORREF SetBkColor(
HDC hdc, // handle of device context
COLORREF crColor // background color value
);

to set the text''s color, you can use:
COLORREF SetTextColor(
HDC hdc, // handle to device context
COLORREF crColor // text color
);

Use the macro RGB(r,g,b) to create a COLORREF value and make sure you call these functions before you use TextOut.

Example, blue text, green background, at 100,100:

char message[] = "message";
HDC hDC;
Surface->GetDC(&hDC)
SetBkColor(hDC,RGB(0,255,0));
SetTextColor(hDC,RGB(0,0,255));
TextOut(hDC,100,100,message,strlen(message));
Surface->ReleaseDC(hDC);
You can use SetBkMode to set the text so that the background shows through. Look it up in VC++ help or the MSDN.

------------------------------
#pragma twice

This topic is closed to new replies.

Advertisement