Custom Node subclass with custom render commands

Hello!

I will try to implement a more memory-efficient TMXTiledMap (since our current game, Idle Raiders, requires it), but I don’t know how to integrate it with the rest of the Cocos2d-JS framework.

Are there any resources available on how to implement a custom cc.Node subclass which integrates properly into the cc.Node hierarchy and how to implement custom drawing for WebGL and canvas for it?

Also, is there some documentation available on pre-existing draw commands in Cocos2d-JS, so I may re-use them?

Nobody knows? Cocos2d-JS devs help me! :smiley:

Basically, you need to implement three classes:

  • FastTiledLayer extended from cc.Node / cc.Sprite
  • FastTiledLayerWebGLRenderCmd extended from CCNodeWebGLRenderCmd / CCSpriteWebGLRenderCmd. You can refer to the Sprite render command implementation for what should be done.
  • FastTiledLayerCanvasRenderCmd extended from CCNodeCanvasRenderCmd / CCSpriteCanvasRenderCmd. You can refer to the Sprite render command implementation for what should be done.

They are all rendered by CCRenderer

Sorry there is no much documentation about the renderer.