Sign in to follow this  

GUI problem

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

This topic is 4596 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this