GUI problem

Started by
1 comment, last by doctorsixstring 18 years, 11 months ago
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!
theDarxWorks
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.
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

This topic is closed to new replies.

Advertisement