That's very informative and helpful, but it's a lot of info to take into
consideration, especially for a novice like me. I will surely have more
questions on the subject in the future.
Here is one question regarding event handling within cocos.
This is what I did in the EventDispatcher subclass for now (it's a map
editor):
types = [
> 'show_menu',
> 'hide_menu',
> 'create_label',
> 'clear_labels',
> 'create_tiles',
> 'place_tile',
> 'remove_tile',
> ]
>
> for event in types:
> self.register_event_type(event)
>
The documentation says to do this as Emitter.register_event_type('...')
rather than self, but in this case there will not be multiple emitters
being created and removed so I think this is fine. Have I misunderstood the
use of this? It seems to be the same sort of thing as is happening in the
Tetrico example.
I guess what I'm confused about is the semantics of this, because 'register
event type' sounds like what the listener would do, rather then the
emitter. Is it possible to implement this without predefining all the event
types, and registering them in this manner? Any instructions are
appreciated.
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" 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/cocos-discuss.
For more options, visit https://groups.google.com/groups/opt_out.