本文整理汇总了C++中CCScale9Sprite::setVisible方法的典型用法代码示例。如果您正苦于以下问题:C++ CCScale9Sprite::setVisible方法的具体用法?C++ CCScale9Sprite::setVisible怎么用?C++ CCScale9Sprite::setVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCScale9Sprite
的用法示例。
在下文中一共展示了CCScale9Sprite::setVisible方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateProgress
void BBProgressBar::updateProgress()
{
float pv = (m_fCurrent - m_fMin) / (m_fMax - m_fMin);
if(m_fMax - m_fMin == 0) pv=0;
if(pv<0) pv=0;
if(pv>1) pv=1;
switch (m_nProgressBarMode)
{
case BB_PROGRESSBAR_MODE_SCALE:
{
}
break;
//基于9格缩放的进度条机制
case BB_PROGRESSBAR_MODE_LAYOUT:
{
CCSize sizeLayout = m_pBackground->getContentSize();
sizeLayout.width *= pv;
CCScale9Sprite* pro = dynamic_cast<CCScale9Sprite*>(m_pProgress);
if(pro)
{
pro->setPreferredSize(sizeLayout);
if(m_bHideProgress) pro->setVisible(false);
else if(pv>0.01) pro->setVisible(true);
else pro->setVisible(false);
}
if(m_pLabel)
{
m_pLabel->setString(FORMAT("%d", (int)m_fCurrent));
}
}
break;
case BB_PROGRESSBAR_MODE_CIRCLE:
{
if(m_pPotentiometer)
{
m_pPotentiometer->setMaximumValue(m_fMax);
m_pPotentiometer->setMinimumValue(m_fMin);
m_pPotentiometer->setValue(m_fCurrent);
}
}
break;
}
};
示例2: resetScroll
void resetScroll(){
if(!_scrollBar){ return;}
CCSize vs = getViewSize(), cs = getContentSize();
bool vert = getDirection() == kCCScrollViewDirectionVertical;
bool v = vert? vs.height < cs.height : vs.width < cs.height;
_scrollBar->setVisible(v);
CCPoint p = ccp(0, 0), ap = vert? ccp(1,0) : CCPointZero;
if(v){
CCSize s = _scrollBar->getPreferredSize(),
st = _scrollTrack? _scrollTrack->getPreferredSize() : CCSizeZero;
if(vert){
p.x = vs.width + _scrollOffset - (st.width > 0? (st.width - s.width) / 2 : 0);
_scrollTrackDelta = st.height > 0? (st.height - s.height) / 2 : 0;
s.height = vs.height / cs.height * vs.height - _scrollTrackDelta * 2;
}else{
p.y = vs.height + _scrollOffset - (st.height > 0? (st.height - s.height) / 2 : 0);
_scrollTrackDelta = st.width > 0? (st.width - s.width) / 2 : 0;
s.width = vs.width / cs.width * vs.width - _scrollTrackDelta * 2;
}
_scrollBar->setAnchorPoint(ap);
_scrollBar->setPreferredSize(s);
_scrollBar->setPosition(p);
//CCLog("LuaTableView vScroll.size=%d,%d vh=%d ch=%d", (int)s.width, (int)s.height, (int)vs.height, (int)cs.height);
}
if(_scrollTrack){
_scrollTrack->setVisible(v);
if(v){
CCSize s = _scrollTrack->getPreferredSize();
if(vert){
p.x = vs.width + _scrollOffset;
s.height = vs.height;
}else{
p.y = vs.height + _scrollOffset;
s.width = vs.width;
}
_scrollTrack->setAnchorPoint(ap);
_scrollTrack->setPreferredSize(s);
_scrollTrack->setPosition(p);
}
}
//CCLog("LuaTableView reload vscr=%x visible=%d", _scroller, _scrollBar->isVisible());
updateScroll();
}
示例3: getTarget
void CCAnimate9SpriteProgress::update(float fraction)
{
CCNode* target = getTarget();
CCScale9Sprite* sprite = (CCScale9Sprite*)target;
float width = beginSize.width + fraction * distance;
if (capAtMax)
width = std::min(width, maxWidth);
else
while (width - maxWidth > 1e-3) width -= maxWidth;
if (width - minWidth < 1e-3)
width = minWidth;
sprite->setVisible(width > minWidth);
sprite->setContentSize(CCSize(width, beginSize.height));
}