Jump to content
  • Advertisement
Sign in to follow this  
spiffycrony

Drawing Text in Directx8

This topic is 4079 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to draw a text on the picture box using directx8 + vb6. I am using the following code. But it doesn't work i.e i dont see the text on the screen. Function InitText() As Boolean Set d3d = New d3dx8 Dim iDFont As IFont Dim rRec As RECT Dim dSetfont As IFontDisp Dim fnt As New StdFont fnt.Name = "Arial" fnt.Size = 24 Set iDFont = fnt Set m_font = d3d.CreateFont(m_d3d.Device, iDFont.hFont) End Function Public Sub RenderText() m_font.Begin Dim rec As RECT rec.Left = Picture1.Width / 2 rec.top = Picture1.Height / 2 rec.Right = Picture1.Width / 2 + 100 rec.bottom = Picture1.Height / 2 + 100 d3d.DrawText m_font, RGB(255, 0, 0), "XYZ", rec, DT_LEFT m_font.End End Sub Am i missing something?

Share this post


Link to post
Share on other sites
Advertisement
This code is massively incomplete, and I don't know that you can output to a 'picture box' either. Are you initializing the m_d3d.device object correctly (resolution, windowed mode, etc)? Do you have a render loop (ie beginScene and endScene followed by .present?)

You might be setting up the font object correctly but I think your understanding of Direct3D and how it works is incomplete -- unless you are intentionally omitting a ton of code. I used to use the same type of font code in VB/DX8 so maybe I can look it up for you if you're still having trouble, but I have long since written my own font engine and it's much better. :)

Share this post


Link to post
Share on other sites
Hi MasterWorks,

You are right. Its only part of the code which I copied here. Any I found the problem was in the color. I was using RGB while directx expect ARGB. Also I had to adjust my rectangle values. I guess no much documentation is available for this kind of problem. After hours of searching, i stumbled upon an useful site. I am sure it will help others.


http://externalweb.exhedra.com/DirectX4VB/Tutorials/DirectX8/GR_Lesson06.asp


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!