Hi all, A bit of background to explain my question:
I'm currently writing a port of xpenguins in Clutter/gnome javascript bindings (just for a bit of fun). The idea is that I wish to spawn many toons (penguins) on the screen. Each toon is basically a Clutter.Texture. It is 'animated' in the sense that it has a single image (like a cartoon) and animation is simulated by sliding the actor's clip box over each frame of the cartoon. However, even though there may be many (say 50) toons on the screen, there are only (say) 5 different *types* of toon: each individual toon is either a walker, runner, cycler, floater, or skateboarder. Each type of toon has its own little filmstrip image to represent its animation. Now, I could spawn each of the 50 toons by having each *individual* toon store a copy of its filmstrip image. This seems easiest (each toon is just a Clutter.Texture), but also seems inefficient. The way the original XPenguins does it and the way I'd like to try, is to have some central ToonData object, one per type of toon. So in my example I'll have 5 of them. Each ToonData has its image filmstrip loaded up. Then, when an individual toon is drawn, it looks up the ToonData corresponding to its type and picks out the frame of the animation it is up to. In this way, I only need to have 5 image filmstrips loaded up in memory, instead of one filmstrip per toon. My question is, how can I implement this situation? Could it be that ToonData.image is a Clutter.Image, and each Toon is a Clutter.Texture, but somehow each Toon stores a pointer to the corresponding ToonData.image? How do I do that? I envisage someting like: Toon.prototype = { __proto__: Clutter.Texture, _init: function() { // this.data is a pointer to the ToonData for the toon's type. } ... } var toon = new Toon(); Toon.set_image_pointer( toon.data.image ); Is this possible? I basically want to just load the image once per toon type rather than once per toon. Or do I have to make each Toon a Clutter.Actor and somehow override the paint method to look up the image & display? Can anyone recommend how I can go about this? cheers! _______________________________________________ clutter-app-devel-list mailing list clutter-app-devel-list@clutter-project.org http://lists.clutter-project.org/listinfo/clutter-app-devel-list