bgui icon indicating copy to clipboard operation
bgui copied to clipboard

Changing positioning/sizing representation

Open atbentley opened this issue 11 years ago • 8 comments

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.

atbentley avatar Apr 12 '14 19:04 atbentley

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.

Moguri avatar Apr 13 '14 04:04 Moguri

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?

atbentley avatar Apr 13 '14 15:04 atbentley

Nope, the changes should automatically be reflected here as you push commits to your branch.

Moguri avatar Apr 13 '14 21:04 Moguri

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.

atbentley avatar Apr 14 '14 19:04 atbentley

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.

atbentley avatar Apr 14 '14 20:04 atbentley

I guess a user can always temporarily add BGUI_NO_NORMALIZE to a widget to adjust it's pixel position.

Moguri avatar Apr 14 '14 21:04 Moguri

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.

Moguri avatar May 08 '14 03:05 Moguri

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.

atbentley avatar May 08 '14 15:05 atbentley