Archived

This topic is now archived and is closed to further replies.

DorRaba

Rendering text to screen

Recommended Posts

DorRaba    122
I''m using visual basic and I don''t know how to create text and render it to screen using Direct3D. can anyone help me or give me some source code?

Share this post


Link to post
Share on other sites
DorRaba    122
This is my code:
fntOut.DrawText("SAMPLE TEXT", New Drawing.Rectangle(5, 5, 0, 0), _
DrawTextFormat.Left Or rawTextFormat.Top, _
Drawing.Color.FromArgb(255, 200, 128, 64))

i''m writing it a few times for few texts but I get an error:

"Overload resolution failed because no accessible ''DrawText'' accepts this number of arguments."

The VB.NET Helper sais there is another argument before the first one that needs to be a sprite object, I don''t know what it means and what should I do?

Share this post


Link to post
Share on other sites
xyzzy00    307
You should be able to pass whatever the VB equivalent of NULL is for the Sprite parameter.

You only need to worry about passing in a Sprite object if you are drawing many lines of text, and want to avoid the overhead of saving and restoring device state between each DrawText call. Or if you are doing something fancy, like scaling and rotating your text, you''d need to use a Sprite object to control that.

xyzzy

Share this post


Link to post
Share on other sites
Carandiru    212
Using the DirectX SDK Help file, look @ the definition for the class D3DXFont, if you are using SDK version 9.0b w/Summer Update, the D3DXFont class has been updated and is highly optimized. CD3DFont is also another alternative but is also available, very fast and in most cases faster. But it is unsupported. You can find the definition of this file in the C:\D3DSDK9\EXAMPLES\COMMON

Hope this helps.

Share this post


Link to post
Share on other sites