ScrollView uses new renderer now.

This commit is contained in:
James Chen 2014-01-07 17:46:24 +08:00
parent 44a02ba466
commit 5c217f70d1
2 changed files with 21 additions and 2 deletions

View File

@ -485,10 +485,17 @@ void ScrollView::addChild(Node * child, int zOrder, int tag)
} }
} }
void ScrollView::beforeDraw()
{
_beforeDrawCommand.init(0, _vertexZ);
_beforeDrawCommand.func = CC_CALLBACK_0(ScrollView::onBeforeDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_beforeDrawCommand);
}
/** /**
* clip this view so that outside of the visible bounds can be hidden. * clip this view so that outside of the visible bounds can be hidden.
*/ */
void ScrollView::beforeDraw() void ScrollView::onBeforeDraw()
{ {
if (_clippingToBounds) if (_clippingToBounds)
{ {
@ -513,11 +520,18 @@ void ScrollView::beforeDraw()
} }
} }
void ScrollView::afterDraw()
{
_afterDrawCommand.init(0, _vertexZ);
_afterDrawCommand.func = CC_CALLBACK_0(ScrollView::onAfterDraw, this);
Director::getInstance()->getRenderer()->addCommand(&_afterDrawCommand);
}
/** /**
* retract what's done in beforeDraw so that there's no side effect to * retract what's done in beforeDraw so that there's no side effect to
* other nodes. * other nodes.
*/ */
void ScrollView::afterDraw() void ScrollView::onAfterDraw()
{ {
if (_clippingToBounds) if (_clippingToBounds)
{ {

View File

@ -254,11 +254,13 @@ protected:
* clip this view so that outside of the visible bounds can be hidden. * clip this view so that outside of the visible bounds can be hidden.
*/ */
void beforeDraw(); void beforeDraw();
void onBeforeDraw();
/** /**
* retract what's done in beforeDraw so that there's no side effect to * retract what's done in beforeDraw so that there's no side effect to
* other nodes. * other nodes.
*/ */
void afterDraw(); void afterDraw();
void onAfterDraw();
/** /**
* Zoom handling * Zoom handling
*/ */
@ -351,6 +353,9 @@ protected:
/** Touch listener */ /** Touch listener */
EventListenerTouchOneByOne* _touchListener; EventListenerTouchOneByOne* _touchListener;
CustomCommand _beforeDrawCommand;
CustomCommand _afterDrawCommand;
}; };
// end of GUI group // end of GUI group