I'm building a very simple 2d GUI system for my game. My only feature requirements are that I need to be able to put text, images, and buttons on cascading (overlapping) windows. From what I've read here, using 3d meshes and/or sprites for GUIs is preferred to using 2d drawing functions - I recall it being said that the 2d functions are very slow on some hardware.
My current plan involves using separate entities for each window so I can use EntityOrder to obscure windows which should be "under" other windows. Also, to allow text to overlap decals - and both to overlap the window background - I'm thinking I'll need an additional two entities per window (i.e. Background, Artwork, Overlay).
Each window's "top-most" entity (Overlay) will have a surface with my font texture, and I'll create quads with the appropriate UV coords to paste individual letters onto my window.
Is my plan completely insane in any way? Can anyone think of a way to simplify any of this?
P.S. I decided not to use any of the plethora of existing GUI systems because I got tired of trying to find one which met all four of my requirements: free, simple, fast, and good code-quality. Many of the libraries I checked out were packed with a kitchen sink-full of features and seemingly not modular at all, meaning it would be difficult to strip out the features I won't need or make modifications. Some seemed to be in varying states of repair, while others didn't even compile.
|