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~
DirectDraw DrawText
Enix (or someone who knows):
the GDI way, how do you set the text color and the color behind the text?
the GDI way, how do you set the text color and the color behind the text?
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);
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);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement