Hey there,

I've been using pywidget (https://pywidget.googlecode.com/svn/trunk) with 
cocos2d quite successfully as a GUI, but in order to do so I've had to hack 
the cocos director class. 

Basically, modifying Director::on_draw to read, at the end:

       # Draw the GUI
        if self.gui != None:
          self.gui.on_draw()

Where you pass in the appropriate pywidget gui object by assigning it to 
the director:

class Client:
  def run(self):

    cocos.director.director.init()
    cocos.director.director.gui = dialog
    cocos.director.director.window.push_handlers(dialog)

    ui = rpg.ui.Test()
    main_scene = cocos.scene.Scene (ui)
    cocos.director.director.run (main_scene)

This seems fairly successful in that the cocos event handlers still work, 
and the event bindings for the UI work, so all in all, pretty good.

However, it's annoying having to patch the cocos source to do this. 

I feel like I should just be able to extend CocosNode and override the 
draw() method, then add the object to the scene, but my draw() function 
never seems to get called when I do this.

Is there some special magic I need to do?

I'd prefer not to hack up the source just to have a gui if I can avoid it.

~
Doug.

-- 
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?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to