Jump to content
  • Advertisement
Sign in to follow this  
daObi

GUI problem

This topic is 4880 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

Hi, Granted that its better to use textures and polygons to display say gui panel, than create a lockable surface and blt what ever you want, but how can one manage text inputs since its dynamic. do u implement the drawtext function provided by dxfont, which is in itself a wiered api, or use the dc of the main window. the problem is i am not implementing any extended utility provided by directx except the library itself. i created my own bitmap to texture loader function and everything else i'll need. however, i am at a fix considering for text inputs. can anybody help!

Share this post


Link to post
Share on other sites
Advertisement
Just create a bitmap with all of the ASCII characters (or unicode) and save the data for each character rect (UVs), such that you can map each character's UV's into a quad, then when rendering a string, loop thru your string and depending on the craracter you need, grav the UV's for that character and draw a quad with the character's UV's, advance your X position and do the same for the next character.

If you use static width and height fonts, all you would need would be an offset, and then calculate the UV's from that offset.

Share this post


Link to post
Share on other sites
You should check out the Microsoft.DirectX.Direct3D.Font class, if you're using Managed DirectX, or the ID3DXFont in "standard" DirectX. I originally implemented a method like Kwizatz described, but for you I think it would probably be best to use existing tools, rather than reinventing the wheel. It might even have better performance than what you write, unless you implement a method to pre-render your strings to a single textured-quad, like you can do with Font/ID3DXFont.

Good luck!

- Mike

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!