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

Direct3D Font Bitmap

Started by robotarcade Jan 19, 2005 at 1:28 AM 1 replies 600+ views
Original Post
robotarcade
robotarcade
Hello, I am making an ID3DXSprite based game, and I would like to try to display some text. (Player's score) I have made my own font, (Just charcaters 0-9). The characters are monospace, each one 23 pixels wide. These charcaters are together in a bitmap/texture. font example I imagine that I could display a player's score by doing the following: 1. Create X number of sprite rectangles, where X is the maximum charcater length that a score could be. 2. Create a "key" string, like so: "key = 0123456789"; 3. Use a score variable, such as "score = 2743". I could convert this variable to a string, then for each character in the score string, search the key string for it, and record the place of the matching character in the string. For example, the character "2" appears at place 3 in the key string. I could make my first sprite display the charcater "2" in the font bitmap like so: leftEdge = 23 * 3; // Or, I could display each letter based on its ascii value, by using a texture similar to what "Bitmap Font Builder" makes. But this seems overly complex. Is there an easier way to do this in Direct3D 8/9, C++? [Edited by - robotarcade on January 19, 2005 4:05:49 AM]
robotarcade
robotarcade
Thank you for replying. Will ID3DXFont allow me to use my own bitmap? (I like the color gradient)

Topic Locked

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

Sign in to reply to this topic.