I think your code is quite complicated and not very efficient. If you resize the window your HUD does not follow :( HUD is something needed in many games so it would be great if soya could provide an easy way to do this.
If I may suggest I think GUI windows should be placeable on the root layer. Since window can contains any widget then it could be used to place any widget on the screen and make HUD like stuff easily. The ability to set the position of a window on the screen would also allow the user to animate the GUI like having window that pop from the side of the screen when they appear or window that shack to draw the user's attention. Jiba, do you think that is doable ? Here is a proposition : I would define a window position on the screen with 4 parameters : width_ratio, height_ratio, width_margin and height_margin. The position of the top left corner of a window on the screen would be calculated with the following x = width_ratio * (screen_width - window_width) + width_margin y = height_ratio * (screen_height - window_height) + height_margin width_ratio and height_ratio are float between 0 and 1. If a window width_ratio is 1 the window right border will always be on the screen right border, if width_ratio is 0 then the window left border will be on the screen left border, even if the screen is resized. width_margin and height_margin are signed integer, a number of pixel used as an offset. If a window width_ratio is 1 and width_margin is 10 then the window right border will always be 10 pixel away from the screen right border. Even if the screen is resized the margin would still be 10 pixel. Ok that is just my idea, don't hit me please :) Souvarine. Nico Schoenmaker wrote: > Hi all, > > I've been playing around a bit with the new widget system for soya, and > so far it works pretty good. The Open Slime menu code went down a lot, I > think about 50% less code! :-) > > Also I've implemented the new widget system for use in our HUD, and > doing that was a bit trickier. The new widget system is based on > automatically placement of the items, but that doesn't work so well for > usage in a HUD. In a HUD you want free placement of your labels, like, > say a goalcounter in the topright position. > > Anyway, I managed to implement it in our HUD, so I figured I'd share the > way how I made it work. Might be usefull as a gui-HUD.py tutorial? > http://pastebin.com/f51a96c2b > > Offcource you can place more then just labels this way, I also managed > to get a resizing progressbar. For more info on that see > https://code.launchpad.net/~openslimeteam/openslime/devel (Browse code > -> HUD.py) > > Nycko > http://openslime.nschoenmaker.nl > > _______________________________________________ > Soya-user mailing list > Soya-user@gna.org > https://mail.gna.org/listinfo/soya-user > > _______________________________________________ Soya-user mailing list Soya-user@gna.org https://mail.gna.org/listinfo/soya-user