OK, I've made my own gaming engine with it's own pseudo-windows and what not. When it comes to render the windows onto the device context it becomes tricky if I want one window to appear in front or behind another window. I thought about ZOrdering but when a window is created what ZOrder number will it use?
For example, I have 15 'pseudo windows' plus the background window (total of 16 windows). The background will always have to have 0 as a ZOrder number, and the other windows will have to use numbers 1 to 15 for render ordering. I was thinking that initially, all 15 windows will have a ZOrder number of 1 to 15. If a Window is to be placed above a set of Windows, it will 'push' all the windows before it down one value until the Window that previously had the ZOrder number is cleared and can be used for the Window that wanted it.
Here's an example (my code is actually in C++ but I figure a lot more people know VB here!):
Public Type GameWindow
ZOrder As Long
End Type
Public GameWindows(0 to 15) As GameWindow
Public Sub Initialise()
Dim X As Integer
For X = 0 To 15
GameWindows(X).ZOrder = X
Next X
End Sub
Public Sub ZOrder(WindowIndex As Integer, NewZOrder As Integer)
If (WindowIndex = NewZOrder) Or (NewZOrder > 15) Or (NewZOrder < 1) Then Exit Sub
'Here I am stuck because the order of the array will be constant but the order
'of ZOrder numbers will be constantly changing!
End Sub
Any ideas would be greatly appreciated!