|
||
|
GP Mailing List
ATXGPSIG List
|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: text writing in directX
Okay, below I have the function that I use to write to the screen in
DirectDraw exclusive mode
It takes as arguments:
a string of text or a character buffer to output
the starting (x,y) coordinates
the COLORREF value of the color of the text
and the DirectDraw Surface to write the text to
int DrawGDIText(char *text, int x,int y, COLORREF color, LPDIRECTDRAWSURFACE
lpdds)
{
// for COLORREF use the RGB(r,g,b) macro
HDC xdc; // the working dc
// Get the device context to draw text
if (lpdds->GetDC(&xdc)!=DD_OK)
return(0);
SetTextColor(xdc,color);
// set background mode to transparent so black isn't copied
SetBkMode(xdc, TRANSPARENT);
// Output text to screen
TextOut(xdc,x,y,text,strlen(text));
lpdds->ReleaseDC(xdc);
return(1);
}
Hope this helps you do what you need to do.
-Brian
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com
=================================================================
The GameProgrammer.Com mailing list is for the open discussion
of any topic related to the art, science, and business of
programming games. This list is especially tolerant of beginners.
We were all beginners once
To SUBSCRIBE or UNSUBSCRIBE please visit:
http://gameprogrammer.com/mailinglist.html
|
|