BOOL CSendingDialog::OnInitDialog() { CBaseDialog::OnInitDialog(); CMlsPropertyControl::SubclassPropertyControls(this); CenterWindow(); CProgressBar* pProgress = (CProgressBar*)GetDlgItem(IDC_PROGRESS_BAR); pProgress->SetMinMaxPos(0, 100, 0); m_pModem = new CModem; // Set up the monitor. m_pMonitor = new CSendingMonitor; m_pMonitor->SetModem(m_pModem); m_pMonitor->SetDialog(this); CString csText; TRY { csText.LoadString(IDS_Working); } END_TRY ShowStatus(csText); SetState(Initializing); return TRUE; }
void CSendingMonitor::SetState(int nState) { m_nState = nState; if (m_pProgress != NULL) { switch (m_nState) { case CSendingDialog::Sending: { m_pProgress->SetPos(0); m_pProgress->ShowWindow(SW_SHOW); break; } case CSendingDialog::Receiving: { m_pProgress->SetPos(50); break; } case CSendingDialog::Succeeded: { m_pProgress->SetPos(100); break; } default: { // Nothing special. break; } } } }
CProgressBar* CProgressBar::create() { CProgressBar* pRet = new CProgressBar(); if( pRet && pRet->init() ) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
CProgressBar* CProgressBar::create(const char* pProgress) { CProgressBar* pRet = new CProgressBar(); if( pRet && pRet->initWithFile(pProgress) ) { pRet->autorelease(); return pRet; } CC_SAFE_DELETE(pRet); return NULL; }
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); }
void CFoulerDoc::AddDataFromText(DWORD dwSize, char *pHeader) { char seps[] = "abcdfghijklmnopqrstuvwxyzABCDFGHIJKLMNOPQRSTUVWXYZ= ,\t\n:()"; char *token, *cpTextData; int i, iOrg, iData, itemno, iIndex; double dData; BeginWaitCursor(); for (DWORD dw = 0; dw < dwSize; dw++) { if (pHeader[dw] == NULL) pHeader[dw] = ' '; } cpTextData = new char[dwSize]; memcpy( cpTextData, pHeader, dwSize ); itemno = GetItemNo( cpTextData ); delete[] cpTextData; if( itemno < 1 ) return; CProgressBar* pBar = new CProgressBar(); iData = m_iNo; iOrg = m_iOriginNo; InsertData( itemno ); iIndex = 0; token = strtok( pHeader, seps ); while( token!= NULL ) { dData = atof(token); if( dData != 0 ) { m_pOrgData[iOrg]->SetItem( dData ); m_iSubGroupIndex++; if( m_iSubGroupIndex >= m_iSubGroupSize ) { m_iSubGroupIndex = 0; dData = 0; for( i=iOrg+1-m_iSubGroupSize ; i<iOrg+1 ; i++ ) { dData += m_pOrgData[i]->GetItem(); } m_pData[iData]->SetItem(dData/m_iSubGroupSize); iData++; AnalysisData(); } iOrg++; iIndex++; pBar->SetPos((iIndex<<8)/itemno); } token = strtok( NULL, seps ); } delete pBar; EndWaitCursor(); }
BOOL CFoulerDoc::OpenCCA(HANDLE hFileRead) { char cHeader[32]; double dData = 0; DWORD nCount; DWORD dwHighSize, dwLowSize; int i; ZeroMemory( cHeader, sizeof(cHeader) ); dwLowSize = GetFileSize( hFileRead, &dwHighSize ); SetFilePointer( hFileRead, 0, NULL, FILE_BEGIN); ReadFile( hFileRead, cHeader, 32, &nCount, NULL ); if( strcmp( cHeader, "Control Chart Analyzer File" ) != 0 ) return FALSE; int itemno = 0; ReadFile( hFileRead, &itemno, sizeof(itemno), &nCount, NULL ); if( itemno < 0 ) return FALSE; if( dwLowSize < itemno*sizeof(dData)+32+sizeof(itemno)+sizeof(m_histogram)+sizeof(m_shewart)+sizeof(m_cusum)+sizeof(m_sprt) ) return FALSE; ClearData(); ReadFile( hFileRead, &m_histogram, sizeof(m_histogram), &nCount, NULL ); ReadFile( hFileRead, &m_shewart, sizeof(m_shewart), &nCount, NULL ); ReadFile( hFileRead, &m_cusum, sizeof(m_cusum), &nCount, NULL ); ReadFile( hFileRead, &m_sprt, sizeof(m_sprt), &nCount, NULL ); double* pData; pData = new double[itemno]; ReadFile( hFileRead, pData, sizeof(dData)*itemno, &nCount, NULL ); double *dp; dp = pData; CProgressBar* pBar = new CProgressBar(); InsertData( itemno ); for( i=0 ; i<itemno ; i++ ) { m_pOrgData[i]->SetItem( *dp ); m_iSubGroupIndex++; if( m_iSubGroupIndex >= m_iSubGroupSize ) { m_iSubGroupIndex = 0; dData = 0; for( int j=i+1-m_iSubGroupSize ; j<i+1 ; j++ ) { dData += m_pOrgData[j]->GetItem(); } m_pData[i/m_iSubGroupSize]->SetItem(dData/m_iSubGroupSize); AnalysisData(); } dp++; pBar->SetPos( (i<<8)/itemno ); } delete[] pData; delete pBar; return TRUE; }
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, 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; }
void CFoulerDoc::AnalysisWholeData() { int i; int iTemp = 0; double dPlus = 0; double dMinus = 0; if( m_histogram.GetReady() ) { for( i=0 ; i < DEF_HISTOGRAM_SIZE ; i++ ) { m_iHistogram[i] = 0; } CProgressBar* pBar = new CProgressBar(); for( i=0 ; i < m_iNo ; i++ ) { if( m_pData[i]->GetItem() < m_histogram.GetTheta0()-5*m_histogram.GetDeviation() ) { m_iHistogram[0] ++; continue; } else if( m_pData[i]->GetItem() > m_histogram.GetTheta0()+5*m_histogram.GetDeviation() ) { m_iHistogram[DEF_HISTOGRAM_SIZE-1] ++; continue; } iTemp = (int)( (m_pData[i]->GetItem()-m_histogram.GetTheta0())*DEF_HISTOGRAM_SIZE/10/m_histogram.GetDeviation() + DEF_HISTOGRAM_SIZE/2 ); m_iHistogram[iTemp]++; //Histogram계산용 도수분포 dPlus = m_pData[i]->GetItem() - m_cusum.GetK() - m_cusum.GetTheta0() + dPlus; if( dPlus < 0 ) dPlus = 0; m_pData[i]->SetPlus( dPlus ); dMinus = m_pData[i]->GetItem() + m_cusum.GetK() - m_cusum.GetTheta0() + dMinus; if( dMinus > 0 ) dMinus = 0; m_pData[i]->SetMinus( dMinus ); //CUSUM, SPRT계산용 pBar->SetPos( (i<<8)/m_iNo ); } delete pBar; } }
void CGUIWindow::LoadProgressBar(CProgressBar** progressBar_aux, CXMLTreeNode& pNewNode, const Vect2i& screenResolution, CTextureManager* tm) { //<ProgressBar name="progressBar1" posx="200" posy="600" height="10" width="100" visible="true" active="true" // texture_back="hola" texture_bar="hola2" id_font="0" color_font_r="0" color_font_g="0" color_font_b="0" // Literal="blabla" widthOffset="" heightOffset="" OnComplete="blabla"/> CProgressBar* progressBar; std::string name = pNewNode.GetPszProperty("name", "defaultGuiElement"); float posx = pNewNode.GetFloatProperty("posx", 0.f); float posy = pNewNode.GetFloatProperty("posy", 0.f); float w = pNewNode.GetFloatProperty("width", 50.f); float h = pNewNode.GetFloatProperty("height", 50.f); bool visible = pNewNode.GetBoolProperty("visible", true); bool activated = pNewNode.GetBoolProperty("active", true); std::string texture_bar = pNewNode.GetPszProperty("texture_bar", ""); std::string texture_back = pNewNode.GetPszProperty("texture_back", ""); std::string OnComplete = pNewNode.GetPszProperty("OnComplete", ""); uint32 idFont = pNewNode.GetIntProperty("id_font", 0); float color_font_r = pNewNode.GetFloatProperty("color_font_r", 0.f); float color_font_g = pNewNode.GetFloatProperty("color_font_g", 0.f); float color_font_b = pNewNode.GetFloatProperty("color_font_b", 0.f); std::string l_literal = pNewNode.GetPszProperty("Literal", ""); float widthOffsetPercent = pNewNode.GetFloatProperty("widthOffset", 0.f); float heightOffsetPercent = pNewNode.GetFloatProperty("heightOffset", 0.f); CTexture* bar = tm->GetTexture(texture_bar); CTexture* back = tm->GetTexture(texture_back); uint32 widthOffset = (uint32) (screenResolution.x * 0.01f * widthOffsetPercent ); uint32 heightOffset = (uint32) (screenResolution.y * 0.01f * heightOffsetPercent ); progressBar = new CProgressBar( screenResolution.y,screenResolution.x, h, w, Vect2f(posx, posy), l_literal, heightOffset, widthOffset, visible, activated); progressBar->SetName(name); progressBar->SetTextures(back, bar); progressBar->SetFont(idFont, CColor(color_font_r,color_font_g,color_font_b)); progressBar->SetOnComplete(OnComplete); *progressBar_aux = progressBar; }
virtual bool onEvent(ode::IIrrOdeEvent *pEvent) { bool bRet=false; if (pEvent->getType()==ode::eIrrOdeEventProgress) { ode::CIrrOdeEventProgress *pEvt=reinterpret_cast<ode::CIrrOdeEventProgress *>(pEvent); wchar_t s[0xFF]; if (pEvt->getCount()==0) { swprintf(s,0xFF,L"Loading scene..."); m_pText->setText(s); } else { swprintf(s,0xFF,L"Physics Initialization: %i / %i",pEvt->getCurrent(),pEvt->getCount()); m_pText->setText(s); m_pBar->setProgress(100*pEvt->getCurrent()/pEvt->getCount()); } m_pDriver->beginScene(true, true, video::SColor(0,200,200,200)); m_pGuienv->drawAll(); m_pDriver->endScene(); } return bRet; }
virtual void progress (const char *message, float progress) { ProgressBar.setLine(0, string(message)); ProgressBar.update(); ProgressBar.updateProgressBar ((uint32)(100 * progress)); }
void closeMaxLighter() { ProgressBar.uninitProgressBar (); }
void initMaxLighter(Interface& _Ip) { ProgressBar.initProgressBar (100, _Ip); }
void CNelExport::viewMesh (TimeValue time) { // Register classes // done in dllentry registerSerial3d (); CScene::registerBasics (); // Register CPath in our module regsiterOVPath (); // Create an object viewer IObjectViewer* view = IObjectViewer::getInterface(); // Check wether there's not an instance currently running if (view->isInstanceRunning()) { ::MessageBox(NULL, "An instance of the viewer is currently running, please close it :)", "NeL Export", MB_OK|MB_ICONEXCLAMATION); return; } // set the water pool manager view->setWaterPoolManager(NL3D::GetWaterPoolManager()); // Build a skeleton map mapRootMapBoneBindPos skeletonMap; std::map<INode*, CSkeletonDesc> mapSkeletonShape; if (view) { // Init it if (!view->initUI()) { ::MessageBox(NULL, "Failed to initialize object viewer ui, this may be a driver init issue, check your log.log files", "NeL Export", MB_OK|MB_ICONEXCLAMATION); IObjectViewer::releaseInterface(view); return; } // Get node count int nNumSelNode=_Ip->GetSelNodeCount(); int nNbMesh=0; // Create an animation for the models CAnimation *autoAnim=new CAnimation; // ******************* // * First build skeleton bind pos information and animations // ******************* int nNode; for (nNode=0; nNode<nNumSelNode; nNode++) { // Get the node INode* pNode=_Ip->GetSelNode (nNode); // It is a zone ? if (RPO::isZone (*pNode, time)) { } // Try to export a mesh else if (CExportNel::isMesh (*pNode, time)) { // Build skined ? bool skined=false; // Skinning ? if (CExportNel::isSkin (*pNode)) { // Get root of the skeleton INode *skeletonRoot=CExportNel::getSkeletonRootBone (*pNode); // HULUD TEST //skeletonRoot=NULL; // Root exist ? if (skeletonRoot) { // Ok, look for the set in the map of desc mapRootMapBoneBindPos::iterator iteSkeleton=skeletonMap.find (skeletonRoot); // Not found ? if (iteSkeleton==skeletonMap.end()) { // Insert one skeletonMap.insert (mapRootMapBoneBindPos::value_type (skeletonRoot, CExportNel::mapBoneBindPos())); iteSkeleton=skeletonMap.find (skeletonRoot); } // Add the bind pos for the skin CExportNel::addSkeletonBindPos (*pNode, iteSkeleton->second); } } } } // ******************* // * Then, build skeleton shape // ******************* for (nNode=0; nNode<nNumSelNode; nNode++) { // Get the node INode* pNode=_Ip->GetSelNode (nNode); // It is a zone ? if (RPO::isZone (*pNode, time)) { } // Try to export a mesh else if (CExportNel::isMesh (*pNode, time)) { // Build skined ? bool skined=false; ++nNbMesh; // Skinning ? if (CExportNel::isSkin (*pNode)) { // Get root of the skeleton INode *skeletonRoot=CExportNel::getSkeletonRootBone (*pNode); // HULUD TEST //skeletonRoot=NULL; // Root exist ? if (skeletonRoot) { // Ok, look for the set in the map of desc mapRootMapBoneBindPos::iterator iteSkeleton = skeletonMap.find (skeletonRoot); std::map<INode*, CSkeletonDesc>::iterator skelBindPod = mapSkeletonShape.find (skeletonRoot); // Not found ? if (skelBindPod==mapSkeletonShape.end()) { // Insert it CSkeletonShape *skelShape=new CSkeletonShape(); // A matrix id map TInodePtrInt mapId; // Build the skeleton based on the bind pos information _ExportNel->buildSkeletonShape (*skelShape, *skeletonRoot, &(iteSkeleton->second), mapId, time); // Add the shape in the view uint instance = view->addSkel (skelShape, skeletonRoot->GetName()); // Add tracks CAnimation *anim=new CAnimation; _ExportNel->addAnimation (*anim, *skeletonRoot, "", true); // Set the single animation view->setSingleAnimation (anim, "3dsmax current animation", instance); // Insert in the map mapSkeletonShape.insert (std::map<INode*, CSkeletonDesc>::value_type ( skeletonRoot, CSkeletonDesc (instance, mapId))); } } } } } CAnimationSet *animationSet = new CAnimationSet; for (nNode=0; nNode<nNumSelNode; nNode++) { // Get the node INode* pNode=_Ip->GetSelNode (nNode); // Is it a automatic light ? if yes add tracks from nel_light (color controller) int bAnimated = CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_LM_ANIMATED, 0); if (bAnimated) _ExportNel->addAnimation( *autoAnim, *pNode, "", true); } animationSet->addAnimation ("Automatic", autoAnim); animationSet->build(); view->setAutoAnimation (animationSet); // ******************* // * Then, build Mesh shapes // ******************* // Prepare ig export. std::vector<INode*> igVectNode; std::map<std::string, NL3D::IShape *> igShapeMap; // SunDirection. NLMISC::CVector igSunDirection(0, 1, -1); // SunColor. NLMISC::CRGBA igSunColor(255, 255, 255); SLightBuild sgLightBuild; // Build Mesh Shapes. CProgressBar ProgBar; ProgBar.initProgressBar (nNbMesh, *_Ip); theExportSceneStruct.FeedBack = &ProgBar; nNbMesh = 0; // Map for IG animations typedef std::map<INode *, CAnimation *> TIGAnimation; TIGAnimation igAnim; // View all selected objects for (nNode=0; nNode<nNumSelNode; nNode++) { // Get the node INode* pNode=_Ip->GetSelNode (nNode); string sTmp = "Object Name: "; sTmp += pNode->GetName(); ProgBar.setLine (0, sTmp); sTmp = ""; for (uint32 i = 1; i < 10; ++i) ProgBar.setLine (i, sTmp); sTmp = "Last Error"; ProgBar.setLine (10, sTmp); ProgBar.update(); // It is a zone ? if (RPO::isZone (*pNode, time)) { } // Try to export a mesh else if (CExportNel::isMesh (*pNode, time)) { // Build skined ? bool skined=false; ++nNbMesh; // Skinning ? if (CExportNel::isSkin (*pNode)) { // Create a skeleton INode *skeletonRoot=CExportNel::getSkeletonRootBone (*pNode); // HULUD TEST //skeletonRoot=NULL; // Skeleton exist ? if (skeletonRoot) { // Look for bind pos info for this skeleton mapRootMapBoneBindPos::iterator iteSkel=skeletonMap.find (skeletonRoot); std::map<INode*, CSkeletonDesc>::iterator iteSkelShape=mapSkeletonShape.find (skeletonRoot); nlassert (iteSkel!=skeletonMap.end()); nlassert (iteSkelShape!=mapSkeletonShape.end()); // Export the shape IShape *pShape; pShape=_ExportNel->buildShape (*pNode, time, &iteSkelShape->second.MapId, true); // Build succesful ? if (pShape) { // Add the shape in the view uint instance = view->addMesh (pShape, pNode->GetName(), iteSkelShape->second.SkeletonInstance); // Add tracks CAnimation *anim=new CAnimation; _ExportNel->addAnimation (*anim, *pNode, "", true); // Set the single animation view->setSingleAnimation (anim, "3dsmax current animation", instance); // ok skined=true; } } } // Build skined ? if (!skined) { // Export the shape IShape *pShape = NULL; pShape=_ExportNel->buildShape (*pNode, time, NULL, true); // Export successful ? if (pShape) { // get the nelObjectName, as used in building of the instanceGroup. std::string nelObjectName= CExportNel::getNelObjectName(*pNode); // ugly way to verify the shape is really added to the sahepBank: use a refPtr :) NLMISC::CRefPtr<IShape> prefShape= pShape; std::string nelObjectNameNoExt; // Add to the view, but don't create the instance (created in ig). if (!(nelObjectName.find(".shape") != std::string::npos || nelObjectName.find(".ps") != std::string::npos)) { nelObjectNameNoExt = nelObjectName; nelObjectName += ".shape"; } else { std::string::size_type pos = nelObjectName.find("."); nlassert(pos != std::string::npos); nelObjectNameNoExt = std::string(nelObjectName, 0, pos); } // Add to the view, but don't create the instance (created in ig). // Since IG use strlwr version of the name, must strlwr it here. std::string nelObjectNameLwr= nelObjectName; strlwr(nelObjectNameLwr); view->addMesh (pShape, nelObjectNameLwr.c_str(), 0xffffffff, NULL, false); // If the shape is not destroyed in addMesh() (with smarPtr), then add it to the shape map. if(prefShape) { igShapeMap.insert( std::make_pair(nelObjectNameNoExt, pShape) ); } // Add to list of node for IgExport. igVectNode.push_back(pNode); } // Add tracks igAnim.insert (TIGAnimation::value_type (pNode, new CAnimation)); _ExportNel->addAnimation (*igAnim[pNode], *pNode, "", true); } } ProgBar.updateProgressBar (nNbMesh); if( ProgBar.isCanceledProgressBar() ) break; } // if ExportLighting, Export all lights in scene (not only selected ones). if(theExportSceneStruct.bExportLighting) { // List all nodes in scene. vector<INode*> nodeList; _ExportNel->getObjectNodes(nodeList, time); // For all of them. for(uint i=0;i<nodeList.size();i++) { INode *pNode= nodeList[i]; if( sgLightBuild.canConvertFromMaxLight(pNode, time) ) { // Convert it. sgLightBuild.convertFromMaxLight(pNode, time); // PointLight/SpotLight/AmbientLight ?? if(sgLightBuild.Type != SLightBuild::LightDir) { // Add to list of node for IgExport. igVectNode.push_back(pNode); } // "SunLight" ?? else if( sgLightBuild.Type == SLightBuild::LightDir ) { // if this light is checked to export as Sun Light int nExportSun= CExportNel::getScriptAppData (pNode, NEL3D_APPDATA_EXPORT_AS_SUN_LIGHT, BST_UNCHECKED); if(nExportSun== BST_CHECKED) { // Add to list of node for IgExport (enabling SunLight in the ig) igVectNode.push_back(pNode); // Replace sun Direciton. igSunDirection= sgLightBuild.Direction; // Replace sun Color. igSunColor= sgLightBuild.Diffuse; } } } } } ProgBar.uninitProgressBar(); theExportSceneStruct.FeedBack = NULL; // ******************* // * Export instance Group. // ******************* // Info for lighting: retrieverBank and globalRetriever. CIgLighterLib::CSurfaceLightingInfo slInfo; slInfo.RetrieverBank= NULL; slInfo.GlobalRetriever= NULL; // Result instance group vector<INode*> resultInstanceNode; // Build the ig (with pointLights) NL3D::CInstanceGroup *ig= _ExportNel->buildInstanceGroup(igVectNode, resultInstanceNode, time); if(ig) { // If ExportLighting if( theExportSceneStruct.bExportLighting ) { // Light the ig. NL3D::CInstanceGroup *igOut= new NL3D::CInstanceGroup; // Init the lighter. CMaxInstanceLighter maxInstanceLighter; maxInstanceLighter.initMaxLighter(*_Ip); // Setup LightDesc Ig. CInstanceLighter::CLightDesc lightDesc; // Copy map to get info on shapes. lightDesc.UserShapeMap= igShapeMap; // Setup Shadow and overSampling. lightDesc.Shadow= theExportSceneStruct.bShadow; lightDesc.OverSampling= NLMISC::raiseToNextPowerOf2(theExportSceneStruct.nOverSampling); clamp(lightDesc.OverSampling, 0U, 32U); if(lightDesc.OverSampling==1) lightDesc.OverSampling= 0; // Setup LightDirection. lightDesc.LightDirection= igSunDirection.normed(); // For interiors ig, disable Sun contrib according to ig. lightDesc.DisableSunContribution= !ig->getRealTimeSunContribution(); // If View SurfaceLighting enabled if(theExportSceneStruct.bTestSurfaceLighting) { // Setup a CSurfaceLightingInfo slInfo.CellSurfaceLightSize= theExportSceneStruct.SurfaceLightingCellSize; NLMISC::clamp(slInfo.CellSurfaceLightSize, 0.001f, 1000000.f); slInfo.CellRaytraceDeltaZ= theExportSceneStruct.SurfaceLightingDeltaZ; // no more add any prefix to the colision identifier. slInfo.ColIdentifierPrefix= ""; slInfo.ColIdentifierSuffix= ""; // Build RetrieverBank and GlobalRetriever from collisions in scene _ExportNel->computeCollisionRetrieverFromScene(time, slInfo.RetrieverBank, slInfo.GlobalRetriever, slInfo.ColIdentifierPrefix.c_str(), slInfo.ColIdentifierSuffix.c_str(), slInfo.IgFileName); } // Light Ig. CIgLighterLib::lightIg(maxInstanceLighter, *ig, *igOut, lightDesc, slInfo, ""); // Close the lighter. maxInstanceLighter.closeMaxLighter(); // Swap pointer and release unlighted one. swap(ig, igOut); delete igOut; } // Setup the ig in Viewer. uint firstInstance = view->addInstanceGroup(ig); // Setup animations uint i; for (i=0; i<ig->getNumInstance(); i++) { // Set the single animation view->setSingleAnimation (igAnim[resultInstanceNode[i]], "3dsmax current animation", firstInstance + i); // Remove the animation igAnim.erase (resultInstanceNode[i]); } } // Add cameras for (nNode=0; nNode<nNumSelNode; nNode++) { // Get the node INode* pNode=_Ip->GetSelNode (nNode); // Is a camera ? if (CExportNel::isCamera (*pNode, time)) { // Export the shape CCameraInfo cameraInfo; _ExportNel->buildCamera (cameraInfo, *pNode, time); // Camera name std::string name = CExportNel::getNelObjectName(*pNode); strlwr (name); uint instance = view->addCamera (cameraInfo, name.c_str ()); // Add tracks CAnimation *anim=new CAnimation; _ExportNel->addAnimation (*anim, *pNode, "", true); // Set the single animation view->setSingleAnimation (anim, "3dsmax current animation", instance); instance++; } } // Erase unused animations TIGAnimation::iterator ite = igAnim.begin(); while (ite != igAnim.end()) { // Delete it delete ite->second; // Next ite++; } // ******************* // * Launch // ******************* // Setup background color if (theExportSceneStruct.bExportBgColor) view->setBackGroundColor(_ExportNel->getBackGroundColor(time)); // ExportLighting? if ( theExportSceneStruct.bExportLighting ) { // Take the ambient of the scene as the ambient of the sun. CRGBA sunAmb= _ExportNel->getAmbientColor (time); // Disable Global ambient light view->setAmbientColor (CRGBA::Black); // setup lighting and sun, if any light added. Else use std OpenGL front lighting view->setupSceneLightingSystem(true, igSunDirection, sunAmb, igSunColor, igSunColor); // If GlobalRetriever for DynamicObjectLightingTest is present, use it. if(slInfo.GlobalRetriever && ig) view->enableDynamicObjectLightingTest(slInfo.GlobalRetriever, ig); } else { /*// Setup ambient light view->setAmbientColor (_ExportNel->getAmbientColor (time)); // Build light vector std::vector<CLight> vectLight; _ExportNel->getLights (vectLight, time); // Light in the scene ? if (!vectLight.empty()) { // Use old Driver Light mgt. view->setupSceneLightingSystem(false, igSunDirection, CRGBA::Black, igSunColor, igSunColor); // Insert each lights for (uint light=0; light<vectLight.size(); light++) view->setLight (light, vectLight[light]); }*/ } // Reset the camera view->resetCamera (); // Go view->go (); // Release object viewer view->releaseUI (); // Delete the pointer IObjectViewer::releaseInterface (view); // Collisions informations are no more used. delete slInfo.RetrieverBank; delete slInfo.GlobalRetriever; } }
void CMainCityUI::updateRoleProperty(const TMessage& tMsg) { UserData *user = DataCenter::sharedData()->getUser()->getUserData(); CLayout* headPart = (CLayout*)m_ui->findWidgetById("head_part"); CLabel *nameLabel = (CLabel*)headPart->getChildByTag(10); nameLabel->setString(user->getRoleName().c_str()); CLabel *level = (CLabel*)(headPart->findWidgetById("level")); level->setString(CCString::createWithFormat("Lv%d",user->getLevel())->getCString()); CLabelAtlas *vip = (CLabelAtlas*)(headPart->findWidgetById("level_vip")); vip->setString(ToString(user->getVip())); if (user->getVip()==0) { vip->setVisible(false); CLabelAtlas *vip_font = (CLabelAtlas*)(headPart->findWidgetById("vip_font")); vip_font->setVisible(false); } CCSprite* head = (CCSprite*)headPart->getChildByTag(15); if (user->getThumb()>0) { // CCTexture2D *texture = CCTextureCache::sharedTextureCache() // ->addImage(CCString::createWithFormat("headIcon/%d.png", user->getThumb())->getCString()); // if (texture) // { // head->setTexture(texture); // } // head->setFlipY(false); CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg")); CCString *strnName = CCString::createWithFormat("headIcon/%d.png", user->getThumb()); CCSprite *sp = CCSprite::create(strnName->getCString()); sp->setPosition(ccpAdd(headBg->getPosition(),ccp(0,10))); sp->setScale(0.75f); headPart->removeChild(head); sp->setTag(15); headPart->addChild(sp); } else { string fbName = user->getFbId()+".jpg"; string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str()); bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName); if(isFileExist) { CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg")); CCSprite *sp = CCSprite::create(fullName.c_str()); CCSprite* spr = MakeFaceBookHeadToCircle(sp); spr->setPosition(headBg->getPosition()); headPart->removeChild(head); spr->setTag(15); headPart->addChild(spr); } else { HttpLoadImage::getInstance()->bindUiTarget(this); CCString *imgUrl = CCString::createWithFormat(FACEBOOKIMG_106,user->getFbId().c_str()); HttpLoadImage::getInstance()->requestUrlImage(imgUrl->getCString(),user->getFbId().c_str()); } } CProgressBar *progressBar = (CProgressBar*)(headPart->getChildByTag(11)); progressBar->setMaxValue(user->getNextExp()); progressBar->startProgress(user->getExp(),0.3f); }
BOOL CFoulerDoc::OpenXLS(CString sFile) { int i; double dData; CDatabase db; CString sSql; CString sItem; CString sDsn; CODBCFieldInfo fieldinfo; CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); if( pFrame->m_strExcelDriver.IsEmpty() ) return FALSE; sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=%s",pFrame->m_strExcelDriver,sFile); TRY { db.Open(NULL,FALSE,TRUE,sDsn);// Open the db using the former created pseudo DSN CRecordset rs( &db );// Allocate the recordset sSql = "SELECT * FROM Data";// Build the SQL string rs.Open(CRecordset::forwardOnly,sSql,CRecordset::readOnly);// Execute that query (implicitly by opening the recordset) CFieldSelect dlg(&rs); if( dlg.DoModal() == IDCANCEL ) { rs.Close(); db.Close(); return FALSE; } BeginWaitCursor(); while( !rs.IsEOF() ) rs.MoveNext(); int iRecCount = (int)(rs.GetRecordCount()); rs.Close(); rs.Open(CRecordset::forwardOnly,sSql,CRecordset::readOnly); CProgressBar* pBar = new CProgressBar(); ClearData(); InsertData( iRecCount ); for( i=0 ; i<iRecCount ; i++ ) { rs.GetFieldValue(dlg.m_sField0,sItem); dData = atof(sItem)+dlg.m_dCo0; if( dlg.m_sField1 >= 0 && dlg.m_dCo1 != 0) { rs.GetFieldValue(dlg.m_sField1,sItem); dData += atof(sItem)*dlg.m_dCo1; } if( dlg.m_sField2 >= 0 && dlg.m_dCo2 != 0) { rs.GetFieldValue(dlg.m_sField2,sItem); dData += atof(sItem)*dlg.m_dCo2; } if( dlg.m_sField3 >= 0 && dlg.m_dCo3 != 0) { rs.GetFieldValue(dlg.m_sField3,sItem); dData += atof(sItem)*dlg.m_dCo3; } m_pOrgData[i]->SetItem( dData ); m_iSubGroupIndex++; if( m_iSubGroupIndex >= m_iSubGroupSize ) { m_iSubGroupIndex = 0; dData = 0; for( int j=i+1-m_iSubGroupSize ; j<i+1 ; j++ ) { dData += m_pOrgData[j]->GetItem(); } m_pData[i/m_iSubGroupSize]->SetItem(dData/m_iSubGroupSize); } rs.MoveNext(); pBar->SetPos( (i<<8)/iRecCount ); } delete pBar; rs.Close(); db.Close(); EndWaitCursor(); return TRUE; } CATCH(CDBException, e) { return FALSE;// A db exception occured. Pop out the details... } END_CATCH; }
void CFoulerDoc::OnEditNewdata() { double dAverage=0, dDeviation=0, dMoveRate=0; int i=0, iNo = 0; char cStr[64]; if( m_generator.GetReady() ) { iNo = 0; dAverage = m_generator.GetAverage(); dDeviation = m_generator.GetDeviation(); dMoveRate = m_generator.GetMoveRate(); } else { iNo = 0; dAverage = 0; dDeviation = 1; dMoveRate = 0; } CNewData dlg( dAverage, iNo, dDeviation, dMoveRate ); if( dlg.DoModal() == IDCANCEL ) return; BeginWaitCursor(); m_generator.SetReady(TRUE); m_generator.SetAverage(dlg.m_average); m_generator.SetDeviation(dlg.m_deviation); m_generator.SetGenMode(dlg.m_iGenMode); m_generator.SetMoveRate(dlg.m_moverate); CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); ZeroMemory( cStr, sizeof(cStr) ); sprintf( cStr, "%f", m_generator.GetAverage() ); if( pFrame != NULL ) pFrame->m_edit.SetWindowText( cStr ); m_dIndex += dlg.m_datano; CProgressBar* pBar = new CProgressBar(); iNo = m_iNo; InsertData( dlg.m_datano ); for( i=iNo ; i<m_iNo ; i++ ) { m_pOrgData[i]->SetItem( m_generator.Gen() ); m_iSubGroupIndex++; if( m_iSubGroupIndex >= m_iSubGroupSize ) { m_iSubGroupIndex = 0; dAverage = 0; for( int j=i+1-m_iSubGroupSize ; j<i+1 ; j++ ) { dAverage += m_pOrgData[j]->GetItem(); } m_pData[i/m_iSubGroupSize]->SetItem(dAverage/m_iSubGroupSize); AnalysisData(); } pBar->SetPos( ((i-iNo)<<8)/dlg.m_datano ); } delete pBar; if( m_histogram.GetReady() == FALSE ) { EndWaitCursor(); OnEditAnalysis(); BeginWaitCursor(); } m_pRightView->Refresh(); ChangeViewMode(m_iViewMode); EndWaitCursor(); }
virtual ~CProgress() { m_pImg->remove(); m_pText->remove(); m_pBar->remove(); ode::CIrrOdeManager::getSharedInstance()->getIrrThread()->getInputQueue()->removeEventListener(this); }
void CMainCityUI::onEnter() { BaseLayer::onEnter(); UserData *user = DataCenter::sharedData()->getUser()->getUserData(); //角色信息相对位置处理 CLayout* headPart = (CLayout*)m_ui->findWidgetById("head_part"); headPart->setPosition(m_ui->convertToNodeSpace(ccp(VLEFT+headPart->getContentSize().width/2, VTOP-headPart->getContentSize().height/2))); //显示角色名,等级,体力,金币 CLabel *nameLabel = (CLabel*)headPart->getChildByTag(10); nameLabel->setString(user->getRoleName().c_str()); nameLabel->setColor(RGB_ROLE_COLOR); CLabel *level = (CLabel*)(headPart->findWidgetById("level")); level->setString(CCString::createWithFormat("Lv%d",user->getLevel())->getCString()); CProgressBar *progressBar = (CProgressBar*)(headPart->getChildByTag(11)); progressBar->setMaxValue(user->getNextExp()); progressBar->startProgress(user->getExp(),0.3f); CLabelAtlas *vip_level = (CLabelAtlas*)(headPart->findWidgetById("level_vip")); vip_level->setString(ToString(user->getVip())); if (user->getVip()==0) { vip_level->setVisible(false); CLabelAtlas *vip_font = (CLabelAtlas*)(headPart->findWidgetById("vip_font")); vip_font->setVisible(false); } CImageView *headbg = (CImageView *)(headPart->findWidgetById("headbg")); headbg->setTouchEnabled(true); headbg->setOnClickListener(this, ccw_click_selector(CMainCityUI::onHeadImgBtn)); CButton *button = nullptr; int i = 1; for (; i<=9; ++i) { CCNode *lay = dynamic_cast<CCNode*>( m_ui->getChildByTag(i)); button = dynamic_cast<CButton*>(lay->getChildByTag(i)); // button->setEnabled(false); button->setOnClickListener(this, ccw_click_selector(CMainCityUI::onClickBtn)); button->setSelectedTexture(((CCSprite*)(button->getNormalImage()))->getTexture()); button->getSelectedImage()->setScale(1.1f); m_btnPos[i] = button->getPosition(); } CCSprite* head = (CCSprite*)headPart->getChildByTag(15); if (user->getThumb()>0) { CCTexture2D *texture = CCTextureCache::sharedTextureCache() ->addImage(CCString::createWithFormat("headIcon/%d.png", user->getThumb())->getCString()); if (texture) { head->setTexture(texture); } } else { string fbName = user->getFbId()+".jpg"; string fullName = CCFileUtils::sharedFileUtils()->fullPathForFilename(fbName.c_str()); bool isFileExist = CCFileUtils::sharedFileUtils()->isFileExist(fullName); if(isFileExist) { CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg")); CCSprite *sp = CCSprite::create(fbName.c_str()); CCSprite* spr = MakeFaceBookHeadToCircle(sp); spr->setPosition(headBg->getPosition()); headPart->removeChild(head); spr->setTag(15); headPart->addChild(spr); } else { HttpLoadImage::getInstance()->bindUiTarget(this); CCString *imgUrl = CCString::createWithFormat(FACEBOOKIMG_106,user->getFbId().c_str()); HttpLoadImage::getInstance()->requestUrlImage(imgUrl->getCString(),user->getFbId().c_str()); } } CImageView* vip = (CImageView*)headPart->findWidgetById("vip"); vip->setTouchEnabled(true); vip->setOnClickListener(this,ccw_click_selector(CMainCityUI::onVip)); //添加签到,充值等其他入口 CAccessLayer* pAccess = CAccessLayer::create(); this->addChild(pAccess, 99); CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_HERO,this,GameMsghandler_selector(CMainCityUI::updateRoleProperty)); CSceneManager::sharedSceneManager()->addMsgObserver(TASK_NOTICE,this,GameMsghandler_selector(CMainCityUI::updateTaskNotice)); CSceneManager::sharedSceneManager()->addMsgObserver(MAIL_NOTICE,this,GameMsghandler_selector(CMainCityUI::updateMailNotice)); CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_FUNCTIONOPEN,this,GameMsghandler_selector(CMainCityUI::updateFuctionOpen)); CSceneManager::sharedSceneManager()->addMsgObserver(UPDATE_GAMETIP,this,GameMsghandler_selector(CMainCityUI::updateGameTip)); CSceneManager::sharedSceneManager()->addMsgObserver(SHOW_HEAD,this,GameMsghandler_selector(CMainCityUI::showHead)); CCSprite *red = (CCSprite*)(m_ui->findWidgetById("redPoint")); CCSprite *mailPoint = (CCSprite*)(m_ui->findWidgetById("mailPoint")); if (user->getRoleAction()<user->getActionLimit()) { this->schedule(schedule_selector(CMainCityUI::updateActionTime),user->getInterval()*60); } GetTcpNet->registerMsgHandler(FriendReqNumMsg,this,CMsgHandler_selector(CMainCityUI::processNetMsg)); GetTcpNet->registerMsgHandler(CBExchangeMsg,this,CMsgHandler_selector(CMainCityUI::exchangeMsg)); //正在引导,不自动弹窗 if(user->getNewStep()==2||user->getNewStep()==17/*CGuideManager::getInstance()->getIsRunGuide()*/) { DataCenter::sharedData()->setCityActionType(CA_None); } else if(user->getNewStep()<=0 || user->getNewStep()>=100) { //自动弹签到 runAction(CCSequence::createWithTwoActions(CCDelayTime::create(0.7f), CCCallFunc::create(this, callfunc_selector(CMainCityUI::autoShowSign)))); } switch (DataCenter::sharedData()->getCityActionType()) { case CA_Levelup: { CButton *btn = (CButton*)m_ui->getChildByTag(HeroInfo_Btn); btn->runAction(CCSequence::create(CCDelayTime::create(0.6f), CCCallFuncN::create(this, callfuncN_selector(CMainCityUI::onTimeWaitCityAction)), NULL)); DataCenter::sharedData()->setCityActionType(CA_None); } break; case CA_GoToChapater: { CButton *btn = (CButton*)m_ui->getChildByTag(Battle_Btn); btn->runAction(CCSequence::create(CCDelayTime::create(0.2f), CCCallFuncN::create(this, callfuncN_selector(CMainCityUI::onTimeWaitCityAction)), NULL)); m_bShowChapterFlag = true; DataCenter::sharedData()->setCityActionType(CA_None); } break; case CA_GoToStage: { this->runAction(CCSequence::create(CCDelayTime::create(0.8f), CCCallFunc::create(this, callfunc_selector(CMainCityUI::runTollgatepreviewCallBack)), NULL)); DataCenter::sharedData()->setCityActionType(CA_None); }break; default: break; } //绑定场景隐藏和显示的消息 NOTIFICATION->addObserver(this, callfuncO_selector(CMainCityUI::show), SHOW_MAIN_SCENE, nullptr); NOTIFICATION->addObserver(this, callfuncO_selector(CMainCityUI::hide), HIDE_MAIN_SCENE, nullptr); NOTIFICATION->addObserver(this, callfuncO_selector(CMainCityUI::checkShowActivity), "CheckShowActivity", nullptr); CCNode *lay = dynamic_cast<CCNode*>( m_ui->getChildByTag(6)); button = dynamic_cast<CButton*>(lay->getChildByTag(6)); CCAnimation *batAnim = AnimationManager::sharedAction()->getAnimation("9015"); batAnim->setDelayPerUnit(0.1f); CCSprite *batLight = createAnimationSprite("skill/9015.png",button->getPosition(),batAnim,true); batLight->setScale(1.4f); m_ui->addChild(batLight); showNoticeTip(CTaskControl::getInstance()->getGameTips()); // CCSprite *spr = CCSprite::create("headImg/506.png"); // spr->setScale(1.2f); // CCSprite *sp = maskedSprite(spr); // CCSprite *headBg = (CCSprite *)(headPart->findWidgetById("headbg")); // sp->setPosition(headBg->getPosition()); // headPart->addChild(sp); //在线礼包 int iNexTime = user->getOnlinePrizeTime(); if (iNexTime!=-1) { if (m_pTimeGift==nullptr) { m_pTimeGift = CTimeGift::create(); m_pTimeGift->setTouchPriority(-3); this->addChild(m_pTimeGift, 2); } m_pTimeGift->setTime(iNexTime); } }
void CTestMenu::testCProgressBar() { CProgressBar *timescale = NULL; CBox Box; Box.iX = g_settings.screen_StartX + 10; Box.iY = g_settings.screen_StartY + 10; Box.iWidth = (g_settings.screen_EndX - g_settings.screen_StartX - 20); Box.iHeight = (g_settings.screen_EndY - g_settings.screen_StartY - 20)/20; timescale = new CProgressBar(Box.iWidth, Box.iHeight, 30, 100, 70, true); timescale->reset(); timescale->paint(Box.iX, Box.iY, 10); usleep(1000000); timescale->paint(Box.iX, Box.iY, 20); usleep(1000000); timescale->paint(Box.iX, Box.iY, 30); usleep(1000000); timescale->paint(Box.iX, Box.iY, 40); usleep(1000000); timescale->paint(Box.iX, Box.iY, 50); usleep(1000000); timescale->paint(Box.iX, Box.iY, 60); usleep(1000000); timescale->paint(Box.iX, Box.iY, 70); usleep(1000000); timescale->paint(Box.iX, Box.iY, 80); usleep(1000000); timescale->paint(Box.iX, Box.iY, 90); usleep(1000000); timescale->paint(Box.iX, Box.iY, 100); delete timescale; timescale = NULL; // hide(); }
void CSendingMonitor::SetDialog(CSendingDialog* pDialog) { m_pDialog = pDialog; m_pProgress = (CProgressBar*)m_pDialog->GetDlgItem(IDC_PROGRESS_BAR); m_pProgress->ShowWindow(SW_HIDE); }