[size=medium]
对cocos2d的API不熟,写几个控件,略感吃力>_<
咱们现炒现卖,边打基础,边建高楼=。=
CCButton
CCTable
[url]http://www.cnblogs.com/eagley/archive/2011/12/16/2289991.html[/url]
CCScrollView
[url]http://www.cocos2d-iphone.org/?s=CCScrollView[/url]
[url]http://www.cocos2d-iphone.org/forum/tags/cctableview[/url]
[/size]
对cocos2d的API不熟,写几个控件,略感吃力>_<
咱们现炒现卖,边打基础,边建高楼=。=
CCButton
CCTable
[url]http://www.cnblogs.com/eagley/archive/2011/12/16/2289991.html[/url]
CCScrollView
[url]http://www.cocos2d-iphone.org/?s=CCScrollView[/url]
[url]http://www.cocos2d-iphone.org/forum/tags/cctableview[/url]
[/size]
-(void)beforeDraw {
glEnable(GL_SCISSOR_TEST);
const CGFloat s = [[CCDirector sharedDirector] contentScaleFactor];
glScissor(self.position.x, self.position.y, viewSize_.width*s, viewSize_.height*s);
}
/**
* retract what's done in beforeDraw so that there's no side effect to
* other nodes.
*/
-(void)afterDraw {
glDisable(GL_SCISSOR_TEST);
}
-(void) visit
{
// quick return if not visible
if (!visible_)
return;
glPushMatrix();
if ( grid_ && grid_.active) {
[grid_ beforeDraw];
[self transformAncestors];
}
[self transform];
[self beforeDraw];
if(children_) {
ccArray *arrayData = children_->data;
NSUInteger i=0;
// draw children zOrder < 0
for( ; i < arrayData->num; i++ ) {
CCNode *child = arrayData->arr[i];
if ( [child zOrder] < 0 ) {
[child visit];
} else
break;
}
// self draw
[self draw];
// draw children zOrder >= 0
for( ; i < arrayData->num; i++ ) {
CCNode *child = arrayData->arr[i];
[child visit];
}
} else
[self draw];
[self afterDraw];
if ( grid_ && grid_.active)
[grid_ afterDraw:self];
glPopMatrix();
}