D3d Font

Posts 18 of 8 · Page 1 of 1
D3d Font
Hey guys I need some help, I have annouying problem with the font, When I start a game the font disappears until I use the scope, after that its all good again, im calling my DrawText function from Hooked Present, Any help or advice would be great

Weird thing is I can't take screenshot to show you what I mean because screenshots or video then menu ect.. doesn't show up

This is Font function I ported from C++
Code:
procedure DrawText(const iLeft, iTop: Integer; szText: PAnsiChar; Color: D3DCOLOR);
var
  d3dRectangle : D3DRECT;
begin
  d3dRectangle.x1:= ileft;
  d3dRectangle.y1:= itop;
  d3dRectangle.x2:= ileft + 1000;
  d3dRectangle.y2:= itop + 1000;

  GetFont.DrawTextA(nil, szText, -1, @D3DRectangle, 0, Color);
end;
You gotta recreate it mmbob releases a source on it awhile back, ill link you

Nvm Someone deleted the thread /fp
Hmm weird, I tried Recreating it as suggested but it didn't work



Here is the code I used...
Code:
procedure MenuInt(pDevice: IDirect3DDevice9);
begin
   if @pD3Ddev <>  Pointer(pDevice) then
   begin
    pD3Ddev:= pDevice;
    MenuFont:= nil;
    if MenuFont = nil then
     D3DXCreateFont(pDevice,10, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH or FF_DONTCARE, 'Terminal', MenuFont);
   end;
end;
Any suggestions or example code would be great...
Sometimes the ingame overwrites your D3D. Either draw your menu in the lower right corner or I use:

Code:
	pDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
	pDevice->SetRenderState( D3DRS_BLENDOP, D3DBLENDOP_ADD );
	pDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
	pDevice->SetRenderState( D3DRS_ALPHATESTENABLE, FALSE );
	pDevice->SetRenderState( D3DRS_SEPARATEALPHABLENDENABLE, FALSE );
	pDevice->SetRenderState( D3DRS_STENCILENABLE, FALSE );
	pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
	pDevice->SetRenderState( D3DRS_VERTEXBLEND, D3DVBF_DISABLE );
	pDevice->SetRenderState( D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE );
	pDevice->SetRenderState( D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE |D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED );
	pDevice->SetRenderState( D3DRS_SHADEMODE, D3DSHADE_GOURAUD );
	pDevice->SetRenderState( D3DRS_FOGENABLE, FALSE );
	pDevice->SetRenderState( D3DRS_SPECULARENABLE, FALSE );
	pDevice->SetRenderState( D3DRS_LIGHTING, FALSE );
	pDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );
	pDevice->SetRenderState( D3DRS_ZWRITEENABLE, FALSE ); 
	pDevice->SetRenderState( D3DRS_ZENABLE, FALSE );
	pDevice->SetRenderState( D3DRS_FILLMODE, D3DFILL_SOLID );
and what @whit was talking about:

Code:
if ( Menu.Font == 0 )
		D3DXCreateFontW(pDevice, 15, 0, 500, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Segoe UI", &Menu.Font );
	else  
	{
		if (g_pDevice != pDevice)
		g_pDevice = pDevice; 
		try 
		{
			if (Menu.Font != 0)
				Menu.Font->Release();        

		} catch (...) {}
		Menu.Font = 0;
		D3DXCreateFontW(pDevice, 15, 0, 500, 0, 0, DEFAULT_CHARSET, OUT_TT_ONLY_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Segoe UI", &Menu.Font );
	}
Setting all those Render States fixed it, thanks Noob

P.s Are you calling them render states every frame?
That is an awesome looking menu for your first menu hack in Delphi
@markoj Thanks

here is it with the all the hacks im going to use...



Just need some XP users and Vista users to test so I know its working for all OS's

Its a movable menu also, and includes menu item highlighting(as seen in Screenshot) and multi colour X-hairs

Anti Dections:
PolyMorphism
Self Removing Header
On the fly Encryption
Packed
Posts 18 of 8 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Need help?