Sign in to follow this  
CodeNow

Making a listbox in D3D

Recommended Posts

Hi all, I am starting to work on the GUI aspect of my game. I will be using texture mapped fonts but in order to do so, I have to recreate certain functionality that D3DXFONT already has and some that that is inherent in windows controls. With that said, the listbox I am creating must be able to display multiple lines of text and perhaps cut in half, height-wise, certain lines of text at the bottom of the listbox. This can be avoided if I make each listbox a certain number of lines in height, but that is a rigid approach. So, I am wondering if there is a method in D3D to be able to draw all of the contents in my listbox but then mask out any parts that are not in the visible portion of the listbox. The other approach is to calculate out the visible portion of each character and draw my primitives for each character accordingly. I hope that all made sense. :) Thanks in advance.

Share this post


Link to post
Share on other sites
Yeah that was the second approach that I mentioned there. It will most likely be faster. I am sure of that. As I think about it, that is likely the approach I will take, but I was curious if there was a way to stencil the square out.

Share this post


Link to post
Share on other sites
That scissor rect sounds like exactly what I had in mind. I can do some sort of test to make sure that I would not render a list item that is not visible at all. Using the scissor rect, I can clip off any parts of visible lines that may not be in the visible area. Sound right?

Share this post


Link to post
Share on other sites
Oddly enough, my laptop does not seem to support Scissor Test. I checked RasterCaps and that is what it seems to show. It's an ATI Radeon 9000 Mobility on a Dell 600m. This is a bit disappointing. This laptop has impressed me so much thus far.

Share this post


Link to post
Share on other sites
Hmmm.... an alternative would be to adjust the viewport.
The problem is setting up the view and projection correctly so that the text is rendered appropriately.

Another alternative is to use a depth stencil.

Unfortunately, none of the alternatives are as clean as the scissor rect :(

Share this post


Link to post
Share on other sites

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