thegooglecodearchive / los-cocos

Automatically exported from code.google.com/p/los-cocos
0 stars 0 forks source link

leaves' transform is not being called #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a custom CocosNode object like MenuItem (cocos/menu.py)
2. Add that object to a layer
3. Let MenuItem execute an action... (nothing happens)

What is the expected output? What do you see instead?
The menuitem shall perform the action but MenuItem.transform() is not being
called. (To try this, uncomment line 333 of menu.py )

Please use labels and text to provide additional information.

Original issue reported on code.google.com by ricardoq...@gmail.com on 21 Apr 2008 at 8:43

GoogleCodeExporter commented 9 years ago
It is not the leaves' transform() that is not being called, but certain custom
cocosnode objects like MenuItem.

Perhaps I am not initializing something ?

Original comment by ricardoq...@gmail.com on 21 Apr 2008 at 8:44

GoogleCodeExporter commented 9 years ago
the logic right now (stolen from sprites) is that node.transform is only called
before you draw your children. if you dont have any children, you dont need to 
call it.

that is, if you have a scaled attribute, you should know how to draw yourself 
scaled.
so there is no need to call "transform". this is so because in this way we can 
do
pyglet sprites optimizations, if not, everything should be 0-based (anchor), 
and in
fixed size. and it requires more gl calls.

let me know if its ok and we can close this, or well have to think a better way.

Original comment by lucio.to...@gmail.com on 21 Apr 2008 at 9:00

GoogleCodeExporter commented 9 years ago
So, how should I fix the MenuItem bug ?
Shall I call manually "transform" in MenuItem.on_draw() ?

Original comment by ricardoq...@gmail.com on 21 Apr 2008 at 9:21

GoogleCodeExporter commented 9 years ago
what i did in color layer is having a layer and inside a cocosnode that draws a
ccolored quad. in this way i inherit the transform.

this is cumbersome when you want to do your own drawing, but it gives you more
options. comments on this are more than welcome.

Original comment by lucio.to...@gmail.com on 21 Apr 2008 at 9:25

GoogleCodeExporter commented 9 years ago
I don't know if this is the "correct" behavior or not, but it was confusing for 
me.
MenuItem will call transform() manually. It is not clear when a CocosNode 
subclass
shall call transform() manually  and when not. lets discuss this on wednesday. 

Original comment by ricardoq...@gmail.com on 21 Apr 2008 at 9:32

GoogleCodeExporter commented 9 years ago

Original comment by lucio.to...@gmail.com on 26 Apr 2008 at 3:03