最简单的方法,从你的DirectDraw表面得到Device Context,然后用GDI画图,不过由于用了GDI,效率不高。 给你贴一段代码:int Draw_Text_GDI(char *text, int x,int y, COLORREF color, LPDIRECTDRAWSURFACE7 lpdds) { HDC xdc; // the working dc// get the dc from surface if (FAILED(lpdds->GetDC(&xdc))) return(0);// set the colors for the text up SetTextColor(xdc,color);// set background mode to transparent so black isn't copied SetBkMode(xdc, TRANSPARENT);TextOut(xdc,x,y,text,strlen(text));lpdds->ReleaseDC(xdc);return(1); }
这一篇什关于用GDI绘制的 http://www.gamedev.net/reference/articles/article1001.asp这个是自己绘制True type font字体,难度比较大 http://www.gamedev.net/reference/articles/article1001.asp
给你贴一段代码:int Draw_Text_GDI(char *text, int x,int y,
COLORREF color, LPDIRECTDRAWSURFACE7 lpdds)
{
HDC xdc; // the working dc// get the dc from surface
if (FAILED(lpdds->GetDC(&xdc)))
return(0);// set the colors for the text up
SetTextColor(xdc,color);// set background mode to transparent so black isn't copied
SetBkMode(xdc, TRANSPARENT);TextOut(xdc,x,y,text,strlen(text));lpdds->ReleaseDC(xdc);return(1);
}
http://www.gamedev.net/reference/articles/article1001.asp这个是自己绘制True type font字体,难度比较大
http://www.gamedev.net/reference/articles/article1001.asp
如果我用定时器闪烁的利害