Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rendering text to screen

Started by DorRaba Jan 18, 2004 at 12:33 AM 5 replies 600+ views
Original Post
DorRaba
DorRaba
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?
DDDDor RRRRaba
DorRaba
DorRaba
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?

DDDDor RRRRaba
DorRaba
DorRaba
Can Someone please help me with my problem???
DDDDor RRRRaba
xyzzy00
xyzzy00
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
DorRaba
DorRaba
What is a Sprite Object and how do I use it?
DDDDor RRRRaba
Carandiru
Carandiru
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.