@Atilim,
@Ar2rsawseen,
Please make
Sprite:setAnchorPoint(0.5, 0.5) |
work in the next Gideros release.
Please, please, please.
In addition, could you make (0.5, 0.5) the DEFAULT anchor point of all objects? That would be wonderful.
These individual ones would be nice too:
Bitmap:setAnchorPoint(0.5, 0.5)
Shape:setAnchorPoint(0.5, 0.5)
Stage:setAnchorPoint(0.5, 0.5)
stage:setAnchorPoint(0.5, 0.5) |
Thanks.
Kate's Catalogue of Travelling Theatre Centres :Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Comments
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Changing such behavior would brake backwards compatibility with any existing app.
Ok lets get it one by one:
Changing default behavior, definitely not, because you know, it would break existing code.
Why Sprite does not have anchor points?
Because it does not have its own boundaries and expand on any added content changing its dimensions. Implementing anchor points to it would be inefficient and ambiguous. Should anchor point stick with specific position after Sprite changed its dimensions, or change it proportionally expanding? If you add something with negative offset, should Sprites 0;0 coordinate change, because its dimensions just expanded, but it did not move? And there are three more variations how anchor point could behave.Either way with native implementation you would have to stick with single behavior that we would need to define, but now you can provide any behavior you want by yourself.
Best approach on achieving what you need
Position elements inside a Sprite object with negative offsets, so internal 0;0 coordinate would always be positioned where you want your anchor point to be.
If you want Sprite anchored to 0.5;0.5, you want to add Bitmap object to it, add it with half negative offset like this:
Why Shape does not have anchor points?
Completely same explanation as with Sprite, even more so, Shape was specifically designed for you to control the anchor point your self, by drawing on internal coordinates. You can even easily specify anchor point completely out of the drawn shape. Providing internal anchor points would only collide with the implementation and create a really hard to understand mess in Shape positioning.Best approach on achieving what you need
Drawing with negative offset. If you want to draw 100x100 shape with 0.5, 0.5 anchor point, do it like this:
Why Stage does not have anchor points?
How do you even imagine that? That 0;0 coordinate is not in the left top corner but lets say in the middle of the screen?But changing Stage's anchor point again could depend and interpreted on many factors, like should logical dimensions or device dimensions used, how to behave in different scaling mode? How to deal with whitespaces/offsets/etc
Best approach on achieving what you need
If you want stage to behave like with 0.5;0.5 anchor point (at screen center), simply position its 0;0 coordinate there, like this:
Hope that helps
Likes: Platypus
@Ar2rsawseen, thank you for your comprehensive, well-formatted rebuttal. You Mellsed me good.*
===============
* For the benefit of people who are studying English:
"You [verb]ed me good" is a jovial expression that deliberately employs incorrect English grammar.
If the expression employed correct grammar, the sentence would be:
"You [verb]ed me well".
"Good" is an adjective.
"Well" is an adverb (instead of saying "goodly").
Meet Kate. Grey is her favourite colour. Maths is her favourite subject. Decency is her favourite type of behaviour.
She definitely does not like jewellery or modelling, but loves aeroplanes and other machines made of aluminium.
Likes: Platypus