The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: ragdog on November 03, 2007, 02:48:53 PM

Title: directx drawtext
Post by: ragdog on November 03, 2007, 02:48:53 PM
hi

i have a problem with my drawtext function
this  draw not my text :'(

invoke D3DXCreateFontA,pd3dDevice,18,8,FW_NORMAL,1,FALSE,DEFAULT_CHARSET,OUT_DEFAULT_PRECIS,PROOF_QUALITY ,(DEFAULT_PITCH+FF_MODERN),offset FontName,addr d3font

      invoke GetActiveWindow
      invoke GetClientRect,eax,addr rct
         add rct.top,120
         add rct.left,20

         push 0
         push d3font
         pop  eax
         push eax
         mov  eax, [eax]
         call dword ptr [eax+Begin]

     push 0FFFFFFFFh                
         push (DT_LEFT+DT_WORDBREAK)
         push  offset rct
         push -1
         push offset Text
         push 0                      
          mov eax,d3font
         push eax
          mov eax,[eax]
         call dword ptr [eax+DrawText]
          add rct.top,eax

         push d3font
          pop eax
         push eax
          mov eax, [eax]
         call dword ptr [eax+End_]


i uses png sprite this draw correcct! can your help me that draw my text please

thanks
ragdog
Title: Re: directx drawtext
Post by: ragdog on November 04, 2007, 11:29:04 AM
I send my source I hope myself can any help now


thanks in forward
ragdog

[attachment deleted by admin]
Title: Re: directx drawtext
Post by: Siekmanski on November 04, 2007, 01:05:11 PM
Here are my latest includes ( "2003" only did some updates I needed, So they are not up to date and not 100% error free !!!)
At least DrawText function works.

greetz Siekmanski





[attachment deleted by admin]
Title: Re: directx drawtext
Post by: ragdog on November 04, 2007, 01:53:10 PM
i have replace this includes with the old includes
and compile my project that draw my text not :'(

here is my replaced includes
http://www.mediafire.com/?0db1qhgmmms

i have solved replace

invoke SetRect,addr rect,10,20,120,20

with this:

     invoke GetActiveWindow
        mov edi,eax
      invoke GetClientRect,edi,addr rect
         add rect.top,120
         add rect.left,20

greets
ragdog
Title: Re: directx drawtext
Post by: Siekmanski on November 04, 2007, 02:49:04 PM
hello ragdog

You have to include the latest d3d9.lib and d3dx9.lib from the directX9 SDK
The last ones I used where the august 2006 ones ( after that date I haven't coded something with D3D9 )
You don't need the advapi32.lib and uuid.lib anymore.

Hope have been some help to you.

Siekmanski

Title: Re: directx drawtext
Post by: ragdog on November 04, 2007, 03:10:22 PM
the last dxsdk_november2007 d3dx9.lib

i have a questions

have a sprite that draw my png and my drawtext
must define that [ NO text in A Sprite ] if I a sprite and drawtext to use would like?

      push TheColor                 
      push (DT_LEFT+DT_WORDBREAK)      
      push rect            
      push -1                     
      push TheText               
      push 0                     ; no Text in a Sprite <<------------------
       mov eax,g_pFont
      push eax
       mov ecx,[eax]
      call dword ptr [ecx+DrawText]   
       add rct.top,eax   

ragdog