• Advertisement
  • entries
    707
  • comments
    1173
  • views
    435288

Clipping

Sign in to follow this  

273 views


This is my problem with the font engine. The white box shows what part area that the text should be in, but since I check to see if its partially visible, it includes the text.

Edit: While writing this I got an idea. I think that I can modify my code so that it takes a few extra parameter, resizing the quad so that its only the portion that is visible. I'll post back in a few minutes.
Sign in to follow this  


4 Comments


Recommended Comments

This sounds like the perfect place for scissor regions, have you looxed into using them?

Share this comment


Link to comment
Nope, I hadn't look into that. I've almost got it working at the moment though (I'll still check out scissor rects, as they may be faster.) The clipping works right, except its not using a big enough box for some reason (I'm going to check my input box first.)

Thanks!

Share this comment


Link to comment


Viola! I had to modify the Quad class, but its a better design now anyway. Before, when you called create it was setting the values for the quad as well as filling the vertices. Then my new function, UpdateVisible(), was reseting the vertices, causing my frame rate to drop about 5 points. Not a huge thing, but now it doesn't drop at all.

The new design has 2 functions to retrieve the vertices - GetUpdatedVertices() which takes a boolean (stating whether or not to use Update() or VisibleUpdate()) and a pointer to the clipping rect (default 0, only needed if the first argument is true). The second is GetVertices() which only returns the vertices (so that you can use the quad class to implement stuff that doesn't need to be updated every frame, but I have to be careful because now the user has to call update after create, or else it won't be visible (until they do call update.)

The clipping rect has to be absolute for it to work (thats what my problem was, I was use relative values in my clipping rect, I'm glad I checked my input first [wink].)

Share this comment


Link to comment
Final bitmap font update for today. I'm glad I decided to try and move the clipping rectangle. I have it set up so that the text can be rendered at one point, and be clipped (so that I can use it for textboxes and stuff), but if the text is above or to the left of the clipping rect, I get a negative number, so part of the character that was outside of the clipping box was being rendered, but not what was in. So, I just added an couple abs() calls and we're good to go as you can see:


I lied, I may take the time to add other formatting to the system (especially centering.) I've decided that the system will use the same syntax as the coloring. So here is a list of commands that it will support at a later time:
^c - center
^v - vertical center
^l - left align
^r - right align
^a - all caps

I'll post some more later, I want to get back to coding.

Share this comment


Link to comment

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

  • Advertisement