While working in cocos's compatibilty with pyglet repo, some differences in
Sprite scaling between cocos and pyglet has been spotted.

Let's compare the pyglet semantic with the cocos semantic:

pyglet:
for applications that never set scale_x nor scale_y, scale tells how much
shrink or grow the sprite image to display; 1.0 is full size, 1.20 is 20%
bigger, 0.7 is 30% smaller. scale_x and scale_y will have the same value as
scale.

for applications that want to display sprites that scale different in
horizontal and vertical, scale_x and scale_y controls the shrink/grow in
each axis.

Reading scale will give a nonsensical number if scale_x != scale_y.

Setting scale will set scale_x and scale_y at the same value, erasing any
differential scaling for horizontal and vertical. So, if at some point in
time it is desired to grow the sprite size, both scale_x and scale_y should
be multiplied by the grow factor.

cocos:
(scale_x, scale_y) controls the ratio width/height ('taller', 'fatier',...)
by shrinking/growing in the respective axis

scale aplies a resize factor over the change done by (scale_x, scale_y)


How it looks to explain some use cases

"I want to triple the size for my sprite"

+ pyglet: do scale_x *= 3; scale_y *= 3, because changing scale will alter
aspect ratio in the generic case
+ cocos: do scale *= 3

"I want to grow by 200% and then shrink to initial size a sprite

pyglet:
scale_x0, scale_y0 = scale_x, scale_y
with t-t0, interpolate in (0, (scale_x0, scale_y0)), (duration/2,
(3*scale_x0, 3*scale_y0)),
(duration, (scale_x0, scale_y0))
(scale_x, scale_y) = scale_x0, scale_y0

cocos:
scale0 = scale
with t-to, interpolate in (0, scale0), (duration/2, 3*scale0), (duration,
scale0)
scale = scale0

The oocos way looks more convenient to me: easier to explain, no special
cases, simpler user code.

So:
- what pyglet users think ?
- pyglets devs are willing to consider to change to the cocos semantics ?

-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to