Advertisement

DrawText ??

Started by February 05, 2000 04:11 PM
3 comments, last by fenrir 25 years, 1 month ago
Could anyone tell my why this doesnt work : g_pDDSBack->DrawText(100,100, "test", FALSE); the following does work : g_pDDSBack->BltFast(30, 10, g_pDDSRood, 0, DDBLTFAST_NOCOLORKEY); I get an error about "drawtextA" is not a member of IDirectdrawsurface7 Why is this function in the docs if it doesnt work??
well, if you are using directx 7, ignore this, since im using directx 6.1
but as of my version of direct x their is no draw text function
you can call draw text by going --

HDC hdc;
surface->GetDC(hdc);
//call windows draw text -- you cant expect anyone to rememebr api parameters at 2 am
surface->ReleaseDC(hdc);

that should work
-PoesRaven
Advertisement
DrawText *IS* in the dx7 docs, but, it *IS* a VB function
for DirectDrawSurface, *NOT* a C++ function
Hope this helps!


char* msg = "test";
HDC hdc;
surface->GetDC(&hdc);
TextOut(hdc, 100, 100, msg, strlen(msg));
surface->ReleaseDC(hdc);
Quite Simply- DrawText is not a DirectX function, it is a windows API function, so after you include windows.h and get yourself a device context you do this:

DrawText ( hdc // device context
,"You're Welcome" // string
,-1 // string length, -1 and DT will figure it out for you
, &rcClient // LPrectange in which you want the text
, DT_SINGLELINE / DT_CENTER / DT_VCENTER );// flags

however, teh function you're trying to use (or at least that you had the parameters set up for is TextOut, as Alastair described.
-Fnj *please forgive me if I sound irate, I have some code that's not working happily*

Edited by - Fnjord on 2/6/00 10:36:58 PM
--- Incompetence is a double edged banana---

This topic is closed to new replies.

Advertisement