Skip to main content
gamedev.net
🔒 Locked

Reorganizing windows algorithm ??

Started by Majestik_666 1 reply 400+ views
Original Post
Majestik_666
Majestik_666
Hi, am building a UI library and am looking for an algorithm for reorganize and fit all my windows inside the parent window... of course windows can be resized and moved... the best for me would be something that leaves the windows at their initial position if possible and grow/shrink them to fit Anyone can help on this one ? Thanks a lot !
Cowboy Coder
Cowboy Coder
Shrink all windows (towards their centers) until there is no overlap. If there is still overlap at 1px window size (unlikely), then move windows alternately sideway or Up/Down .
Expand all windows (from center), one pixel, one a time, push away from edges, pushing other windows away, until no more movement is possible or windows are the desired size.

This will not always work optimally, but i think should give pleasing results most of the time, based on what you describe..
Majestik_666
Majestik_666
yes sounds like it should work :)

I usually don't have that many windows opened (5/6 or so)
so even if it's not optimal it should still give me
all right results.
I'll give it a try !

Thanks a lot!
Francois

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.