Question About D3D Drawing Text

Posts 1–15 of 24 · Page 1 of 2
Question About D3D Drawing Text
Ok so here is acid's post:
Quote Originally Posted by ac1d_buRn View Post

Before we start, Make sure you have this in your globals:
[php]
LPD3DXFONT pFont;
LPDIRECT3DDEVICE9 pDevice;
[/php]

Draw Text:

After Globals:
[php]
void PrintText(LPD3DXFONT Font, long x, long y, D3DCOLOR fontColor, char *text, ...)//Draw Text Function
{
RECT rct;
rct.left = x - 1;
rct.right = x + 1;
rct.top = y - 1 ;
rct.bottom = y + 1;

if(!text) { return; }
va_list va_alist;
char logbuf[256] = {0};
va_start (va_alist, text);
_vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), text, va_alist);
va_end (va_alist);
RECT FontRect = { x, y, x, y };
pFont->DrawText(NULL, logbuf, -1, &rct, DT_NOCLIP, fontColor);
}
[/php]

And to use the function (In Endscene):
[php]
PrintText(pFont, X, Y, D3DCOLOR_XRGB(0,0,0), "Your Text Here");
[/php]

I am pretty new to coding but am really good at VB so I get the handle of it, I've been coding for about 3 weeks now, but when I insert the globals I get an error "IntelliSense: identifier "LPD3DXFONT" is undefined r:\users\r\d\vs\p\6\6\base.cpp".. I am thinking it has to do with some sort of package I have not installed, EG: a D3D package adding LPD3DXFONT. Any help is appreciated, thank you.

EDIT:: A look at my code:
[php]#include <windows.h>
bool IsGameReadyForHook()
{
if( GetModuleHandleA( "d3d9.dll" ) != NULL
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL
&& GetModuleHandleA( "CShell.dll" ) != NULL )
return true;
return false;
}
void PTC(const char* Command) {
DWORD CNADDIE = 0x007d9200;
void* Send = ( void* )*( DWORD* )(CNADDIE);
__asm
{
/* CREDITS TO CN */
push Command;
call Send;
add esp, -3-1+2+6;
}
}
void main()
{
while(true)
{
//Hacks here (removed for length) but they all work.
}}
DWORD WINAPI dwHackThread(LPVOID)
{
while( !IsGameReadyForHook() )
Sleep(100);
main();
return 0;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(NULL, NULL, dwHackThread, NULL, NULL, NULL);
}
return TRUE;
}
[/php]

EDIT:: Also I wanted to thank acid and codernever for everything they are doing in these forums it has been so amazing what they have tought me.
give us the line of code its on but you didnt define it so your kinda no0b..
Actually I did try to define it but it didn't work.

Code with definitions in there:
[php]
#include <windows.h>
LPD3DXFONT pFont;
LPDIRECT3DDEVICE9 pDevice;
bool IsGameReadyForHook()
{
if( GetModuleHandleA( "d3d9.dll" ) != NULL
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL
&& GetModuleHandleA( "CShell.dll" ) != NULL )
return true;
return false;
}
void PTC(const char* Command) {
DWORD CNADDIE = 0x007d9200;
void* Send = ( void* )*( DWORD* )(CNADDIE);
__asm
{
/* CREDITS TO CN */
push Command;
call Send;
add esp, -3-1+2+6;
}
}
void main()
{
while(true)
{
//Hacks here (removed for length) but they all work.
}}
DWORD WINAPI dwHackThread(LPVOID)
{
while( !IsGameReadyForHook() )
Sleep(100);
main();
return 0;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(NULL, NULL, dwHackThread, NULL, NULL, NULL);
}
return TRUE;
}
[/php]

coryster:

Errors with your code (not that you have errors but I do):
[php] 1 IntelliSense: name followed by '::' must be a class or namespace name c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 2
2 IntelliSense: identifier "LPDIRECT3DDEVICE9" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 2
3 IntelliSense: identifier "Directx" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 5
4 IntelliSense: identifier "D3DXCreateFontA" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 6
5 IntelliSense: identifier "Menu" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 8
6 IntelliSense: identifier "D3DCOLOR_ARGB" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 15
7 IntelliSense: identifier "Menu" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 16
8 IntelliSense: expected a ';' c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 20
9 IntelliSense: identifier "PTC" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 61
[/php]
Quote Originally Posted by BlackHaexGuns View Post
Actually I did try to define it but it didn't work.

Code with definitions in there:
[php]
#include <windows.h>
LPD3DXFONT pFont;
LPDIRECT3DDEVICE9 pDevice;
bool IsGameReadyForHook()
{
if( GetModuleHandleA( "d3d9.dll" ) != NULL
&& GetModuleHandleA( "ClientFX.fxd" ) != NULL
&& GetModuleHandleA( "CShell.dll" ) != NULL )
return true;
return false;
}
void PTC(const char* Command) {
DWORD CNADDIE = 0x007d9200;
void* Send = ( void* )*( DWORD* )(CNADDIE);
__asm
{
/* CREDITS TO CN */
push Command;
call Send;
add esp, -3-1+2+6;
}
}
void main()
{
while(true)
{
//Hacks here (removed for length) but they all work.
}}
DWORD WINAPI dwHackThread(LPVOID)
{
while( !IsGameReadyForHook() )
Sleep(100);
main();
return 0;
}
BOOL WINAPI DllMain ( HMODULE hDll, DWORD dwReason, LPVOID lpReserved )
{
DisableThreadLibraryCalls(hDll);
if ( dwReason == DLL_PROCESS_ATTACH )
{
CreateThread(NULL, NULL, dwHackThread, NULL, NULL, NULL);
}
return TRUE;
}
[/php]

coryster:

Errors with your code (not that you have errors but I do):
[php] 1 IntelliSense: name followed by '::' must be a class or namespace name c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 2
2 IntelliSense: identifier "LPDIRECT3DDEVICE9" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 2
3 IntelliSense: identifier "Directx" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 5
4 IntelliSense: identifier "D3DXCreateFontA" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 6
5 IntelliSense: identifier "Menu" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 8
6 IntelliSense: identifier "D3DCOLOR_ARGB" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 15
7 IntelliSense: identifier "Menu" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 16
8 IntelliSense: expected a ';' c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 20
9 IntelliSense: identifier "PTC" is undefined c:\users\main\documents\visual studio 2010\projects\6\6\base.cpp 61
[/php]
Lol bro download DirectX SDK February and the include d3dx9.h into your project
Quote Originally Posted by coryster2100 View Post
Lol bro download DirectX SDK February and the include d3dx9.h into your project
Will do downloading now, thank you for actually helping me instead of just laughing at me.
Code:
void cBase::RenderFrame(LPDIRECT3DDEVICE9 pDevice)
{
	//RenderFrame
	if( Directx.pFont == NULL ){
		D3DXCreateFontA(pDevice, 14, 0, FW_BOLD, 1, FALSE,DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, ANTIALIASED_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &Directx.pFont);
	}else{
		Menu.RenderMenu();
	}

	if( Directx.pFont == NULL )
		Directx.pFont->OnLostDevice();
	else
	{
		Directx.DrawString(0, 0, D3DCOLOR_ARGB(255, 255, 0, 0), Directx.pFont, "TEXT");
Menu.RenderMenu();
	}
This might work idk i am not going to give you mine rite off the back just to keep choobs from C+Ping.

NOTE. this is for a menu base
Include Directx sdk in your project
I know this will probably make you mad but I don't have it. That's why in the first post I was saying I think it has something to do with that since it is not identifying "LPDIRECT3DDEVICE9" or anything.
Lol you don't have a directx hook?
No. I'm not new to programming but I am new to D3D, DirectX, and Combat Arms Hacks..
oh...my...god. do you even have the menu class that gellin provided in your source? of course you are going to have compiling errors
No I don't, I told you I'm new to making hacks, well, directx/d3d hacks.
o think i did laugh at you hence the LOL
instead of just laughing at me.
You didn't JUST laugh at me, you gave me an answer to so, idc if you laugh at me as long as I get help. Hehe
.
You dont even have a directx hook in there.

Just go use gellins base liek every other noob has done.

If you dont know how to fix gellins base, then you wont be able to even do this
Posts 1–15 of 24 · Page 1 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us