Hi,
Is there any guide illustrating API differences between JSB and HTML5. Is it totally guaranteed that single code base will work on both? Documentation says ‘a little changes may be needed’. then which kind of changes are needed? I am writing this because I encountered some situations when something worked on web, but not on win32 target. With a more detail in my personal game project clippingnode works on web as expected, but not on win32. I can neither trace the problem nor debug it for win32. Below code even works when it is firstly called (for win32), then during the game, player somehow updates MG.Rail then draw_rail function called second time, and this.fg1 (sprite to be clipped) disappears totally and game starts to behave strage like a silently corruption without crash. Only clue I have is that MG.pVertices is not cleared as expected when the game corrupts.
using cocos2d-x 3.14
draw_rail: function(){
this.region.removeAllChildren();
this.clipper.removeAllChildren();
var triangles = triangulate(MG.Rail);
var n_tri = triangles.length/3;
// this.stencil = new cc.DrawNode(); // stencil was defined in ctor
// this.clipper = new cc.ClippingNode(); // clipper was defined in ctor
this.stencil.clear();
for(i=0; i<n_tri; i++){
var a_triangle = [cc.p(MG.Rail[triangles[3*i]]), cc.p(MG.Rail[triangles[3*i+1]]), cc.p(MG.Rail[triangles[3*i+2]])];
this.stencil.drawPoly(a_triangle, cc.color(0,255,0,255), 0, cc.color(0,255,0,255));
}
//this.clipper.setStencil(stencil); //set in ctor
//this.clipper.setAnchorPoint(0.5, 0.5); // set in ctor
//this.clipper.setPosition(0, 0); // set in ctor
this.clipper.addChild(this.fg1);
this.region.addChild(this.clipper);
this.highlightRail();
MG.pVertices = [];
MG.direction = '';
}