I never ask for help, to a fault, but I'm stumped on this. I am trying to recreate something like Windows where there is a stack of windows and one window is on top which can be interacted with. When a window that is not on top is clicked on, it goes to the top.
My problem is that I cannot figure out how to move a window from the middle of the stack to the top of the stack so that it can be rendered first and appear on the top.
I'm using C++ and I'm trying to do it in a non-crappy way.
Attached photo with some of my code (doesn't work).