Friday, November 14, 2014

Graphical User Interface (Continued...)

Today, I made some good progress on the graphical user interface library.  Specifically, I completed the two most difficult controls that I'll need: the textbox and combobox.  Next is the listbox.

This library does something that my last one didn't.  When I built my previous library, I didn't know how to clip graphics at the edge of the control.  In other words, if there was too much text on a button, it would spill over the sides.  I thought you had to create a buffer the size of the control, draw on it, and then copy it to the screen.  I found out today, however, that you can use a "scissor rectangle" to clip the edges.  Basically, you say what part of the screen you want to draw to and it will clip anything that runs outside of it.

This doesn't make a huge difference with buttons and similar controls because I'm not going to put too much text in them anyway.  But it's really handy for textboxes.  In my last version, I just calculated how many characters would fit in the box and only drew that many.  This took more processing and wasn't pretty.  It will also come in handy if I ever need to build a scrolling panel.

I'm excited to finish the listbox because that means I'll be able to really start building the editor.  Before we know it, I'll be building levels willy nilly and Sever will be progressing much faster.

Once I have the editor up and running, I'll post screenshots.  If you ever have any suggestions or comments, please share them.  Thanks for reading!

clevceo

No comments: