Code directly. This is an encapsulated layer, which can be called directly // original in vain
Bool TestLayer: init () {CCSize size = CCDirector: sharedDirector ()-> getVisibleSize (); // create the text to be displayed, text = CCLabelTTF :: create ("text \ nbaibai \ nfdffdd \ nzimu \ nhaha \ njahjahjkd \ njhahaj \ n", "", 30); text-> setPosition (ccp (100,-120 )); // draw the CCDrawNode * shap = CCDrawNode: create (); CCPoint point [4] = {ccp (200), ccp (200,200, 0), ccp ), ccp (0,200)}; shap-> drawPolygon (point, 4, ccc4f (355,255,255,255 ), 2, ccc4f (255,255,255,255); CCClippingNode * cliper = CCClippingNode: create (); cliper-> setstencel (shap); cliper-> setAnchorPoint (ccp (. 5 ,. 5); cliper-> setPosition (ccp (100, 20); addChild (cliper ); // Add the text to be rolled to the cropping area cliper-> addChild (text); // scroll the text, and start schedule (schedule_selector (CTestLayer: rollText) after the range is exceeded )); return true;} void TestLayer: rollText (float) {text-> getPositionY ()> 300? Text-> setPositionY (-150): text-> setPositionY (text-> getPositionY () + 2 );}