void MsgBox::event_slider_test(Ref *pSender,int value) { char buf[128] = {0}; sprintf(buf,"%d",value); CLabelAtlas *pLab = (CLabelAtlas*)this->getControl(PANEL_MSGBOX,LABATLAS_NUM); pLab->setString(buf); CProgressBar *pProg = (CProgressBar*)this->getControl(PANEL_MSGBOX,PROG_HP); pProg->setValue(value); }
CProgressBar* TuiManager::createProgress(float tag, const char* bg,const char* progress,float x,float y,float rotation){ CProgressBar *pProgress = NULL; if(m_isUseSpriteFrame){ pProgress = CProgressBar::create(); pProgress->setBackgroundSpriteFrameName(bg); pProgress->setProgressSpriteFrameName(progress); }else{ pProgress = CProgressBar::create(progress); pProgress->setBackgroundImage(bg); } pProgress->setRotation(rotation); pProgress->setPosition(Point(x,-y)); pProgress->setMaxValue(100); pProgress->setMinValue(0); pProgress->setValue(15); pProgress->setTag(tag); return pProgress; }
CProgressBar* TuiManager::createProgress(float tag, int max, int min, int cur, const char* bg, const char* progress,int isShowLabel, float x, float y, float rotation, int isUseFrame){ CProgressBar *pProgress = NULL; if (isUseFrame){ pProgress = CProgressBar::createSpriteFrame(progress); pProgress->setBackgroundSpriteFrameName(bg); }else{ pProgress = CProgressBar::create(progress); pProgress->setBackgroundImage(bg); } pProgress->setShowValueLabel(isShowLabel == 1); pProgress->setRotation(rotation); pProgress->setPosition(Vec2(x,-y)); pProgress->setMaxValue(max); pProgress->setMinValue(min); pProgress->setValue(cur); pProgress->setTag(tag); return pProgress; }