bgui
bgui copied to clipboard
Changing positioning/sizing representation
Implements the ideas suggested in issue #1
It should be noted that this changes the behaviour of size and position attributes so that they return normalized or un-normalized values depending on the options of the widget (previously returned un-normalized values regardless of options). This has the potential to break some user's code if they relied on the previous behaviour.
I'm liking what I see here. It seems like users might want to access the various base_*, so maybe they should be public? I could see myself wanting to move a widget by some pixel amount even if I usually use normalized values.
I've got a final tomorrow but I can get started on the changes you've suggested after that. Would I open a new pull request once thats done?
Nope, the changes should automatically be reflected here as you push commits to your branch.
I've re-added the code for centring widgets on the x, y, width and height setters. This is because of the way a widget updates it's children's size and position after updating it's own.
Centring can be disabled by modifying the widget's options: widget.options ^= BGUI_CENTERED.
It is also worth considering if centring should have an effect on the base position value, instead only modifying the 'higher' position value. Or if it shouldn't even affect those values but rather be a render time operation.
Also, I think making _base* public is a bad idea. Modifying a widget's _base* values won't cause that widget's children to also receive the update.
I guess a user can always temporarily add BGUI_NO_NORMALIZE to a widget to adjust it's pixel position.
Would it be possible for you to rebase and squash some of the commits? I think this is probably about ready to be merged, but it seems rather silly to add 10 commits for this one change. I'm not sure what rebase will do to this pull request, so that should be interesting to find out.
Yeah sure,I think there's still something that needs to be sorted out though. I'm doing some travel right now so I won't be with my computer for a few weeks yet.