NS_MAIN_BEGIN void MsgBox::onLoadScene() { //setAutoRemoveUnusedTexture(true); TuiManager::getInstance()->parseScene(this,"panel_msgbox",PATH_MAIN); //注册事件 CButton *pBtnClose = (CButton*)getControl(PANEL_MSGBOX,BTN_CLOSE); pBtnClose->setOnClickListener(this,ccw_click_selector(MsgBox::event_btn_close)); CSlider *pSlider = (CSlider*)getControl(PANEL_MSGBOX,SLIDER_TEST); pSlider->setOnValueChangedListener(this,ccw_valuechanged_selector(MsgBox::event_slider_test)); CProgressBar *pProg = (CProgressBar*)this->getControl(PANEL_MSGBOX,PROG_HP); pProg->setShowValueLabel(true); }
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; }