Thread: D3d Font

Results 1 to 8 of 8
  1. #1
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh

    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;
    Last edited by Departure; 05-09-2011 at 11:20 AM.

  2. #2
    whit's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    7,170
    Reputation
    490
    Thanks
    2,252
    You gotta recreate it mmbob releases a source on it awhile back, ill link you

    Nvm Someone deleted the thread /fp
    Last edited by whit; 05-09-2011 at 11:46 AM.

  3. #3
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh
    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...

  4. #4
    NOOB's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,863
    Reputation
    425
    Thanks
    8,598
    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 );
    	}

  5. The Following 2 Users Say Thank You to NOOB For This Useful Post:

    Departure (05-09-2011),markoj (05-09-2011)

  6. #5
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh
    Setting all those Render States fixed it, thanks Noob

    P.s Are you calling them render states every frame?
    Last edited by Departure; 05-09-2011 at 08:20 PM.

  7. #6
    markoj's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    s
    Posts
    1,067
    Reputation
    60
    Thanks
    407
    My Mood
    Bored
    That is an awesome looking menu for your first menu hack in Delphi
    Dont ban me

  8. The Following User Says Thank You to markoj For This Useful Post:

    Departure (05-09-2011)

  9. #7
    Departure's Avatar
    Join Date
    Nov 2010
    Gender
    male
    Posts
    818
    Reputation
    125
    Thanks
    1,785
    My Mood
    Doh
    @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
    Last edited by Departure; 05-09-2011 at 10:08 PM.

  10. The Following User Says Thank You to Departure For This Useful Post:

    markoj (05-10-2011)

  11. #8
    Alessandro10_Returns's Avatar
    Join Date
    May 2011
    Gender
    male
    Posts
    8
    Reputation
    10
    Thanks
    2
    My Mood
    Cool
    Quote Originally Posted by Departure View Post
    @markoj Thanks

    here is it with the all the hacks im going to use...
    [img]
    http://i53.tinypic.com/5c15dw.png
    [/img]
    lol

    Nice Menu..

  12. The Following User Says Thank You to Alessandro10_Returns For This Useful Post:

    Departure (05-09-2011)