On 11/02/14 13:13, Mikko Finell wrote:
> I fixed it by calling pyglet.image.load on the file before passing it on
> to the cocos sprite.
> 
> Before it was just cocos.sprite.Sprite directly. (it worked before I
> started rewriting the code)
> 
> It worked without calling pyglet.image.load if the path is not absolute,
> but links to a subfolder of path.dirname(__file__) directly.
> 
> I think this is a bug in pyglet: Unless I'm missing some important
> subtle functionality gained from this behaviour.


Cocos checks if the `image` parameter of Sprite is a string, and if it
is, it uses pyglet.resource.image.

See: http://los-cocos.googlecode.com/svn/trunk/cocos/sprite.py

pyglet.resource module provides a nice way to load images (and other
resources) without fiddling with paths yourself and absolute paths are
not supported.

I recommend you to read the resources doc in pyglet:

http://pyglet.org/doc-current/programming_guide/resources.html

I don't know if cocos docs mention that the image is loaded with
python.resource module, but this is the intended behaviour. So I think
the problem is in cocos that is enhancing pyglet without explaining all
the details.

Regards,

Juan

PS: I've used cocos a couple of times and I love it, but sometimes you
end diving deep in pyglet internals ;)

-- 
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 http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to