Writing a GUI system
Posted: Sun Jul 27, 2008 12:51 am
Hi all
I'm really hoping someone can help me out here - I'm hoping to write a fairly generic, not very complicated GUI system for use in games... I'm thinking of a little mini windows type setup - ie windows, buttons, listboxes, etc etc
All I'm looking for at the moment are ideas on how best to implement it. I've made a start using the HGE engine to render it. Seems like a good idea since it's DX 8 and hardware accelerated.
So far I've managed to get basic "panes" (just blank boxes really) rendering but things such as getting focus, moving windows to the front when clicked etc are a bit baffling. I've almost managed to implement a "MouseOver" function that checks which pane the pointer is currently over, but it doesnt take into consideration which window is the frontmost when 2 or more are overlapped.
I'm currently storing the info relating to a window in the following struct:
Any input at all is most welcome, I've been hunting all over for code examples and tutorials but nothing is much help.
Cheers
I'm really hoping someone can help me out here - I'm hoping to write a fairly generic, not very complicated GUI system for use in games... I'm thinking of a little mini windows type setup - ie windows, buttons, listboxes, etc etc
All I'm looking for at the moment are ideas on how best to implement it. I've made a start using the HGE engine to render it. Seems like a good idea since it's DX 8 and hardware accelerated.
So far I've managed to get basic "panes" (just blank boxes really) rendering but things such as getting focus, moving windows to the front when clicked etc are a bit baffling. I've almost managed to implement a "MouseOver" function that checks which pane the pointer is currently over, but it doesnt take into consideration which window is the frontmost when 2 or more are overlapped.
I'm currently storing the info relating to a window in the following struct:
Code: Select all
Structure Pane
ID.l ; // Handle to pane
*sprite ; // sprite pointer
tl.mVector2 ; // top left x/y coordinate
br.mVector2 ; // bottom right x/y coordinate
s.mVector2 ; // Size of pane - x width * y height
z.b ; // Depth of the pane - will help with focus and render sorting
colour.l ; // colour of pane
EndStructure
Cheers