Quote:
Originally posted by Omni
Okay, I've tried it. Your window focusing is amazing.
Amazing? Gimme some of that stuff you are smoking!
It's rather simple. I just keep a table of open windows, let's say "2,5,10,1,3" (from botton to top). If I want to make a window active, let's assume window 10, I just close all windows untill I reach my number, move the windows above 10 one place down in the list, move window 10 to the end of the list, and simply redraw all windows starting from window 10 previous position till I reach the end.
One minor thing: mouse/window collision seems to be based on the entire mouse rectangle. This means that even if a Window is protruding from beneath another, unless the entire mouse rect can fit inside the rect, you can't focus the window. In my system I use check for a 1-pixel wide rectangle at the top-left pixel coordinate of the mouse.
Not quite. I too use only a one pixel detection. The problem is that my windows are made of a template like this:
While this allows for nice customization, it also creates a invicible frame around the window (the magenta colours which are not drawn). But with a little bit of luck, and some hard thinking, I should be a able to solve this.
But only after the battle system contest
About general speed issues:
The window drawing itself is rather fast, thanks to V3s overall speed. My windows are simple images (or rather two images, one for the frame and one for the body). When a window is moved, I have to blit three images.
1. Restore image (which holds the space under the window before the window was drawn)
2. The Window Body (with text, images or simply the empty body)
3. The Window Frame.
These three images are only altered if something happens with the window. Like resizing or altering the body content. And that is pretty fast too (again, thanks to V3s speed), except for text-wordwrapping. I don't think it would speed up the program if I would skip this too. But if I find the time, I'll try it. Even if it's just to satisfy my curiousity.