GUI design help?

Blitz3D Forums/Blitz3D Beginners Area/GUI design help?

octothorpe(Posted 2005) [#1]
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.


jfk EO-11110(Posted 2005) [#2]
It sounds good although I wouldn't use a quad for each letter because a quick calc says a text with 100 Letters per line and 100 Lines uses 20'000 Triangles. Instead I'd write the text to an imagebuffer, then copyrect it to a big texture.

BTW use the Texture flag 256 when you plan to edit the textures at runtime.


octothorpe(Posted 2005) [#3]
Thanks! I wasn't aware that there was a 256 flag until you wrote this and I looked it up in the online docs. I guess I better start using them instead of the Blitz IDE docs - I don't use the Blitz IDE anyways, I just keep it open for the docs!