void KoCreatePathTool::addPathShape(KoPathShape *pathShape) { Q_D(KoCreatePathTool); KoPathShape *startShape = 0; KoPathShape *endShape = 0; pathShape->normalize(); // check if existing start/end points are still valid d->existingStartPoint.validate(canvas()); d->existingEndPoint.validate(canvas()); pathShape->setStroke(createStroke()); if (d->connectPaths(pathShape, d->existingStartPoint, d->existingEndPoint)) { if (d->existingStartPoint.isValid()) startShape = d->existingStartPoint.path; if (d->existingEndPoint.isValid() && d->existingEndPoint != d->existingStartPoint) endShape = d->existingEndPoint.path; } KUndo2Command *cmd = canvas()->shapeController()->addShape(pathShape); if (cmd) { KoSelection *selection = canvas()->shapeManager()->selection(); selection->deselectAll(); selection->select(pathShape); if (startShape) canvas()->shapeController()->removeShape(startShape, cmd); if (endShape && startShape != endShape) canvas()->shapeController()->removeShape(endShape, cmd); canvas()->addCommand(cmd); } else { canvas()->updateCanvas(pathShape->boundingRect()); delete pathShape; } }
QImage utils::StrokeTester::doStroke(bool cancelled, bool indirectPainting, bool externalLayer, bool testUpdates, bool needQImage) { KisImageSP image = utils::createImage(0, m_imageSize); KoCanvasResourceManager *manager = utils::createResourceManager(image, 0, m_presetFilename); KisNodeSP currentNode; for (int i = 0; i < m_numIterations; i++) { modifyResourceManager(manager, image, i); KisPainter *painter = new KisPainter(); KisResourcesSnapshotSP resources = new KisResourcesSnapshot(image, image->rootLayer()->firstChild(), image->postExecutionUndoAdapter(), manager); if(externalLayer) { KisNodeSP externalNode = new KisPaintLayer(0, "extlyr", OPACITY_OPAQUE_U8, image->colorSpace()); resources->setCurrentNode(externalNode); Q_ASSERT(resources->currentNode() == externalNode); } initImage(image, resources->currentNode(), i); KisStrokeStrategy *stroke = createStroke(indirectPainting, resources, painter, image); m_strokeId = image->startStroke(stroke); addPaintingJobs(image, resources, painter, i); if(!cancelled) { image->endStroke(m_strokeId); } else { image->cancelStroke(m_strokeId); } image->waitForDone(); currentNode = resources->currentNode(); } QImage resultImage; if(needQImage) { KisPaintDeviceSP device = testUpdates ? image->projection() : currentNode->paintDevice(); resultImage = device->convertToQImage(0, 0, 0, image->width(), image->height()); } image = 0; delete manager; return resultImage; }
void KoCreatePathTool::paint(QPainter &painter, const KoViewConverter &converter) { Q_D(KoCreatePathTool); if (pathStarted()) { KoShapeStroke *stroke(createStroke()); if (stroke) { d->shape->setStroke(stroke); } painter.save(); paintPath(*(d->shape), painter, converter); painter.restore(); painter.save(); painter.setTransform(d->shape->absoluteTransformation(&converter) * painter.transform()); KoShape::applyConversion(painter, converter); painter.setPen(QPen(Qt::blue, 0)); painter.setBrush(Qt::white); //TODO make configurable const bool firstPoint = (d->firstPoint == d->activePoint); if (d->pointIsDragged || firstPoint) { const bool onlyPaintActivePoints = false; KoPathPoint::PointTypes paintFlags = KoPathPoint::ControlPoint2; if (d->activePoint->activeControlPoint1()) paintFlags |= KoPathPoint::ControlPoint1; d->activePoint->paint(painter, d->handleRadius, paintFlags, onlyPaintActivePoints); } // check if we have to color the first point if (d->mouseOverFirstPoint) painter.setBrush(Qt::red); //TODO make configurable else painter.setBrush(Qt::white); //TODO make configurable d->firstPoint->paint(painter, d->handleRadius, KoPathPoint::Node); painter.restore(); } if (d->hoveredPoint) { painter.save(); painter.setTransform(d->hoveredPoint->parent()->absoluteTransformation(&converter), true); KoShape::applyConversion(painter, converter); painter.setPen(QPen(Qt::blue, 0)); painter.setBrush(Qt::white); //TODO make configurable d->hoveredPoint->paint(painter, d->handleRadius, KoPathPoint::Node); painter.restore(); } painter.save(); KoShape::applyConversion(painter, converter); canvas()->snapGuide()->paint(painter, converter); painter.restore(); }
//--------------------------------------------------------- // // void CMessageBoxYesNo::onEnter() { CCXMLLayer::onEnter(); LoadPlist( "tip_1.plist" ); const char *MenuButton[] = { "button_yes", "button_no" }; const char *YesNo[] = { "YES", "NO" }; for( int i = 0; i < 2; i++ ) { CCSprite *pSprite= (CCSprite*)GetXMLNodeFromKey( MenuButton[i] ); CCMenu *pMenu = CreatGameUIWithSprite( pSprite, menu_selector(CMessageBoxYesNo::menuCallback), i, this, pSprite->getPosition() ); addChild( pMenu, pSprite->getZOrder() ); removeChild( pSprite, true ); CCLabelTTF* pLabelTTF = CCLabelTTF::labelWithString( YesNo[i], kFontSystem[FONT_GRAND].fontName, kFontSystem[FONT_GRAND].fontSize ); pLabelTTF->setPosition( pMenu->getPosition() ); CCRenderTexture* pstroke = createStroke(pLabelTTF, 1, kFontSystem[FONT_GRAND].strokeColor); addChild( pstroke,100 ); addChild( pLabelTTF,100 ); } CCNode *pNode = GetXMLNodeFromKey( "t2dSceneObject_Message" ); CCLabelTTF* pLabelTTF = CCLabelTTF::labelWithString( m_szBuffer, kFontSystem[FONT_THIN].fontName, kFontSystem[FONT_THIN].fontSize ); pLabelTTF->setPosition( pNode->getPosition() ); CCRenderTexture* pstroke = createStroke(pLabelTTF, 1, kFontSystem[FONT_THIN].strokeColor); addChild( pstroke,100 ); addChild( pLabelTTF,100 ); //pNode = GetXMLNodeFromKey( "t2dSceneObject_tipname" ); //pLabelTTF = CCLabelTTF::labelWithString( m_TitleBuffer, kFontSystem[FONT_THIN].fontName, kFontSystem[FONT_THIN].fontSize ); //pLabelTTF->setPosition( pNode->getPosition() ); //pstroke = createStroke(pLabelTTF, 1, kFontSystem[FONT_THIN].strokeColor); //addChild( pstroke,100 ); //addChild( pLabelTTF,100 ); }
//--------------------------------------------------------------- // // void CAbout::onEnter() { CCXMLLayer::onEnter(); LoadPlist("about.plist"); CCNode *pNode = GetXMLNodeFromKey( "t2dSceneObject_Message" ); string utf8; CChineseCode::GB2312ToUTF_8( utf8, (char*)the_loginmain_designer_text[g_iCurLanguageIndex], 512 ); CCLabelTTF* pLabel = CCLabelTTF::labelWithString( utf8.c_str(),CCSize( 0,0 ), CCTextAlignmentLeft, kFontSystem[FONT_THIN].fontName, kFontSystem[FONT_THIN].fontSize ); pLabel->setPosition( pNode->getPosition() ); CCRenderTexture* pstroke = createStroke(pLabel, 1, kFontSystem[FONT_THIN].strokeColor); addChild( pstroke,100 ); addChild( pLabel,100 ); setIsTouchEnabled( true ); }
int Operators::create(UnaryPredicate1D& pred, vector<StrokeShader*> shaders) { //Canvas* canvas = Canvas::getInstance(); if (!_current_set) { cerr << "Warning: current set empty" << endl; return 0; } StrokesContainer new_strokes_set; for (Operators::I1DContainer::iterator it = _current_set->begin(); it != _current_set->end(); ++it) { if (pred(**it) < 0) goto error; if (!pred.result) continue; Stroke *stroke = createStroke(**it); if (stroke) { if (applyShading(*stroke, shaders) < 0) { delete stroke; goto error; } //canvas->RenderStroke(stroke); new_strokes_set.push_back(stroke); } } for (StrokesContainer::iterator it = new_strokes_set.begin(); it != new_strokes_set.end(); ++it) { _current_strokes_set.push_back(*it); } new_strokes_set.clear(); return 0; error: for (StrokesContainer::iterator it = new_strokes_set.begin(); it != new_strokes_set.end(); ++it) { delete (*it); } new_strokes_set.clear(); return -1; }
//--------------------------------------------------------------------------------- // // void CGameLetter::onEnter() { CCXMLLayer::onEnter(); LoadPlist("message.plist"); m_vMessages.clear(); ccColor4B color ={ 0,0,0,150 }; CCLayerColor* pLayerColor = CCLayerColor::layerWithColor(color); addChild( pLayerColor ); const char *MenuButton[] = { "button_back" }; for( int i = 0; i < 1; i++ ) { CCSprite *pSprite= (CCSprite*)GetXMLNodeFromKey( MenuButton[i] ); CCMenu *pMenu = CreatGameUIWithSprite( pSprite, menu_selector(CGameLetter::menuCallback), i, this, pSprite->getPosition() ); addChild( pMenu, pSprite->getZOrder() ); RemoveNode(pSprite); } //AddMessage( "03/09 11;30" ,"xxxxxxgetmeeeesdgfasdgasdg"); //AddMessage( "03/09 11;30" ,"xxxxxxgetmeeeesdgfasdgasdg"); //AddMessage( "03/09 11;30" ,"xxxxxxgetmeeeesdgfasdgasdg"); //AddMessage( "03/09 11;30" ,"xxxxxxgetmeeeesdgfasdgasdg"); //AddMessage( "03/09 11;30" ,"xxxxxxgetmeeeesdgfasdgasdg"); //AddMessage( "03/09 11;30" ,"xxxxxxgetmeeeesdgfasdgasdg"); //AddMessage( "03/09 11;30" ,"xxxxxxgetmeeeesdgfasdgasdg"); for( int i = MAX_PET_DATA_SAVE_MESSAGE - 1; i >= 0; i-- ) { if( g_pPetDataBlock->recordsave.saveMessage[i].isHas ) { AddMessage( g_pPetDataBlock->recordsave.saveMessage[i].gameDay, g_pPetDataBlock->recordsave.saveMessage[i].strMessage, g_pPetDataBlock->recordsave.saveMessage[i].type, g_pPetDataBlock->recordsave.saveMessage[i].name ); } } CLetterMoveLayer *pMoveLayer = new CLetterMoveLayer(); pMoveLayer->init(); pMoveLayer->autorelease(); pMoveLayer->setIsRelativeAnchorPoint( true ); CCNode *pNode= (CCNode*)GetXMLNodeFromKey( "t2dSceneObject_gamemessageclip" ); pMoveLayer->setContentSize( pNode->getContentSize() ); pMoveLayer->setPosition( pNode->getPosition() ); addChild( pMoveLayer,100 ); m_pGroupNode = CCNode::node(); CCSize s = CCDirector::sharedDirector()->getWinSize(); for( int i = 0; i < m_vMessages.size(); i++ ) { CCNode *pNode= (CCNode*)GetXMLNodeFromKey( "t2dSceneObject_messagebgpos" ); string path = GetGameImagesPath(); path = path + "message_bar.png"; CCSprite *pSprite = CCSprite::spriteWithFile( path.c_str() ); CCPoint pos = pMoveLayer->convertToNodeSpace( pNode->getPosition() ); pSprite->setPosition( ccp( pos.x, pos.y - s.height / 9 * i ) ); m_pGroupNode->addChild( pSprite ); pNode= (CCNode*)GetXMLNodeFromKey( "t2dSceneObject_messagetime" ); char buffer[512]; sprintf( buffer, "%s", m_vMessages[i].strTime.c_str() ); CCLabelTTF *pLabel = CCLabelTTF::labelWithString( buffer,kFontSystem[FONT_TINY].fontName,kFontSystem[FONT_TINY].fontSize); pos = pMoveLayer->convertToNodeSpace( pNode->getPosition() ); pLabel->setPosition( ccp( pos.x, pos.y - s.height / 9 * i ) ); CCRenderTexture *pstroke = createStroke(pLabel, 1, kFontSystem[FONT_TINY].strokeColor); m_pGroupNode->addChild( pstroke ); m_pGroupNode->addChild( pLabel, 1); pNode= (CCNode*)GetXMLNodeFromKey( "t2dSceneObject_gamemessage" ); sprintf( buffer, "%s", m_vMessages[i].strMessage.c_str() ); pLabel = CCLabelTTF::labelWithString( buffer,kFontSystem[FONT_SMALL].fontName,kFontSystem[FONT_SMALL].fontSize); pos = pMoveLayer->convertToNodeSpace( pNode->getPosition() ); pLabel->setPosition( ccp( pos.x, pos.y - s.height / 9 * i ) ); pstroke = createStroke(pLabel, 1, kFontSystem[FONT_SMALL].strokeColor); m_pGroupNode->addChild( pstroke ); m_pGroupNode->addChild( pLabel, 1); pNode= (CCNode*)GetXMLNodeFromKey( "t2dSceneObject_releasemessage" ); pos = pMoveLayer->convertToNodeSpace( pNode->getPosition() ); if( m_vMessages[i].messageType == 0 || g_iGameMode == 0 ) { // string pathTemp = GetGameImagesPath(); // pathTemp = pathTemp + "message_fabu.png"; // CCMenu *pMenu = CreatGameUIButton( pathTemp.c_str(), menu_selector( CGameLetter::weiboCallback), i, this, ccp( pos.x, pos.y - s.height / 9 * i ) ); // m_pGroupNode->addChild( pMenu,100 ); } else { string pathTemp = GetGameImagesPath(); pathTemp = pathTemp + "message_fanji.png"; CCMenu *pMenu = CreatGameUIButton( pathTemp.c_str(), menu_selector( CGameLetter::pushBack), i, this, ccp( pos.x, pos.y - s.height / 9 * i ) ); m_pGroupNode->addChild( pMenu,100 ); } } m_iEachSizeDis = s.height / 9; pMoveLayer->addChild( m_pGroupNode ); setIsTouchEnabled( true ); m_pTarget = CCRenderTexture::renderTextureWithWidthAndHeight(s.width, s.height); m_pTarget->setPosition(ccp(s.width / 2, s.height / 2)); this->addChild(m_pTarget, -1); pNode= (CCNode*)GetXMLNodeFromKey( "money_100" ); if(g_pPetDataBlock->recordsave.weiboGetMoneyCount > 0) { pNode->setIsVisible(true); } else { pNode->setIsVisible(false); } }
/** ------------------------------------------------------------------------ ** * \internal * * \brief Get a Stroke * * * * The stroke decoded is chained in #ISF.strokes and chained to its drawing * * attributes.\n * * The current transform is also applied. * * * * \param pDecISF structure used to decode the ISF file. * * * * \returns the error code given while processing * ** ------------------------------------------------------------------------ **/ int getStroke (decodeISF_t * pDecISF) { int err = OK; INT64 endPayload, packetNumber, value, i, max, min; stroke_t * pStroke; float m11,m12,m13,m21,m22,m23; /** * This tag consist of: * - One MBUINT that represents the payload size in bytes. * - One MBUINT that contains the number of packets following. * - Packet data for GUID_X. * - Packet data for GUID_Y. * - Possibly more in some cases : we can have the pressure on the pen when * the drawing was made * * GUID_X and GUID_Y are both a list of absolute x and y coordinates (in * #Himetric units), where each element in each list maps directly to the * element at the same index in the other list. These form an ordered * list of points. */ err = readMBUINT(pDecISF, &value); /* Check the payload size */ if (err == OK && value != 0) { endPayload = pDecISF->bytesRead + value; LOG(stdout,"payload size = %lld (bytesRead=%lld)\n", value, pDecISF->bytesRead); readMBUINT (pDecISF, &packetNumber); if (packetNumber != 0 ) { LOG(stdout,"packetNumber=%lld\n", packetNumber); err = createStroke( &pStroke, packetNumber, NULL, pDecISF->curDrawAttrs); if (err != OK) return err; /* Link the stroke to its drawing attributes */ pStroke->drawAttrs->nStrokes++; pStroke->nPoints = packetNumber; /* Add the P array if needed */ if (pDecISF->gotStylusPressure == 1) { pStroke->P = (INT64 *) malloc ((unsigned int)packetNumber*sizeof(INT64)); if (!pStroke->P) { free(pStroke->X); free(pStroke->Y); free(pStroke); return OUT_OF_MEMORY; } } /* Decode the X coordinates */ err = decodePacketData(pDecISF, packetNumber, pStroke->X); if (err != OK) { free(pStroke->X); free(pStroke->Y); free(pStroke->P); /* "works" with NULL pointer */ free(pStroke); if (err > OK) finishPayload(pDecISF,"(STROKE)", endPayload); return err; } /* Decode the Y coordinates */ err = decodePacketData(pDecISF, packetNumber, pStroke->Y); if (err != OK) { free(pStroke->X); free(pStroke->Y); free(pStroke->P); /* "works" with NULL pointer */ free(pStroke); if (err > OK) finishPayload(pDecISF,"(STROKE)", endPayload); return err; } if ( pDecISF->gotStylusPressure == 1 ) { /* Decode the pressure array */ err = decodePacketData(pDecISF, packetNumber, pStroke->P); if (err != OK) { free(pStroke->X); free(pStroke->Y); free(pStroke->P); /* "works" with NULL pointer */ if (err > OK) finishPayload(pDecISF,"(STROKE)", endPayload); free(pStroke); return err; } } /* Insert the strokes in the ISF structure */ if (pStroke->drawAttrs->flags & DA_ISHIGHLIGHTER) { /* the job is to insert highlighter strokes before * non-highlighter ones */ pStroke->next = *(pDecISF->lastHighlighterStroke); if (pDecISF->lastStroke == pDecISF->lastHighlighterStroke) /* need to change lastStroke too */ pDecISF->lastStroke = &(pStroke->next); *(pDecISF->lastHighlighterStroke) = pStroke; pDecISF->lastHighlighterStroke = &(pStroke->next); } else { /* Stroke is not a highlighter */ *(pDecISF->lastStroke) = pStroke; pDecISF->lastStroke = &(pStroke->next); } /* Apply the transformation if needed: * (X Y *) = (X Y 1) * transformMatrix */ m11 = pDecISF->curTransform->m11; m12 = pDecISF->curTransform->m12; m13 = pDecISF->curTransform->m13; m21 = pDecISF->curTransform->m21; m22 = pDecISF->curTransform->m22; m23 = pDecISF->curTransform->m23; /* Check whether the transform is not the identity (the default) */ if ( m11 != 1 || m22 != 1 || m12 != 0 || m21 != 0 || m13 != 0 || m23 != 0) { for(i=0; i<packetNumber; i++) { *(pStroke->X+i) = m11 * *(pStroke->X+i) + m12 * *(pStroke->Y+i) + m13; *(pStroke->Y+i) = m21 * *(pStroke->X+i) + m22 * *(pStroke->Y+i) + m23; } } /* We search highest/lowest coords to know the size of the image * since that information is not coded in the format. */ /* First with X coords */ min = max = pStroke->X[0]; for(i=0; i<packetNumber; i++) { if (pStroke->X[i] > max) max = pStroke->X[i]; else { if (pStroke->X[i] < min) min = pStroke->X[i]; } } /* Fill the bounding box for that stroke */ pStroke->xOrigin = min; pStroke->xEnd = max; /* Fill the bounding box for the whole image */ if (pStroke->xOrigin < pDecISF->ISF->xOrigin) pDecISF->ISF->xOrigin = pStroke->xOrigin; if (pStroke->xEnd > pDecISF->ISF->xEnd) pDecISF->ISF->xEnd = pStroke->xEnd; /* Now Y coords */ min = max = pStroke->Y[0]; for(i=0; i<packetNumber; i++) { if (pStroke->Y[i] > max) max = pStroke->Y[i]; else { if (pStroke->Y[i] < min) min = pStroke->Y[i]; } } /* Fill the bounding box for that stroke */ pStroke->yOrigin = min; pStroke->yEnd = max; /* Fill the bounding box for the image if needed */ if (pStroke->yOrigin < pDecISF->ISF->yOrigin) pDecISF->ISF->yOrigin = pStroke->yOrigin; if (pStroke->yEnd > pDecISF->ISF->yEnd) pDecISF->ISF->yEnd = pStroke->yEnd; err = finishPayload(pDecISF,"(STROKE)",endPayload); #ifdef DEBUG LOG(stdout,"\n"); for(i=0; i<packetNumber; i++) { LOG(stdout,"%lld %lld ", pStroke->X[i], pStroke->Y[i]); } LOG(stdout,"\n\n"); #endif } } return err; }
//----------------------------------------------------------------- // // void CTaskEventSubGui::onEnter() { ccColor4B color ={ 0,0,0,150 }; CCLayerColor* pLayerColor = CCLayerColor::layerWithColor(color); addChild( pLayerColor ); CCXMLLayer::onEnter(); LoadPlist( "achievement.plist" ); const char *MenuButton[] = { "button_back" }; for( int i = 0; i < 1; i++ ) { CCSprite *pSprite= (CCSprite*)GetXMLNodeFromKey( MenuButton[i] ); CCMenu *pMenu = CreatGameUIWithSprite( pSprite, menu_selector(CTaskEventSubGui::menuCallback), i, this, pSprite->getPosition() ); addChild( pMenu, pSprite->getZOrder() ); } m_vTaskEvent.clear(); for( int i = 0; i < MAX_TASK_EVNET; i++ ) { CBaseDataEvent* pBaseDataEvent = g_pClientLoader->GetEventDataFromId( g_pPlayerEventCtrl->m_TaskData[i].EventId ); if( NULL != pBaseDataEvent ) { if( 0 == g_pPlayerEventCtrl->GetEventFlag( g_pPlayerEventCtrl->m_TaskData[i].EventId ) ) { STaskEvent taskEvent; taskEvent.eventId = g_pPlayerEventCtrl->m_TaskData[i].EventId; taskEvent.eventLog = CEventLog[pBaseDataEvent->m_SubEvent.m_wSubEventLogID][g_iCurLanguageIndex]; taskEvent.eventIcon = pBaseDataEvent->m_SubEvent.eventicon; CBaseFunRunData *pBaseFunRunData = g_pClientLoader->GetFunRunDataFromId( pBaseDataEvent->m_EventPointInfo.m_iPointRunArray[0] ); if( NULL != pBaseFunRunData ) { taskEvent.targetNum = pBaseFunRunData->m_arrParam[0]; taskEvent.RunIcon = pBaseFunRunData->m_strIcon; } m_vTaskEvent.push_back( taskEvent ); } } } CTaskMoveLayer *pGroup = new CTaskMoveLayer(); pGroup->init(); pGroup->autorelease(); CCNode* pClip = GetXMLNodeFromKey( "t2dSceneObject_achievement_show" ); pGroup->setContentSize( pClip->getContentSize() ); pGroup->setIsRelativeAnchorPoint( true ); pGroup->setPosition( pClip->getPosition() ); m_pGroupNode = CCNode::node(); addChild( pGroup,100 ); pGroup->addChild( m_pGroupNode ); CCSize size = CCDirector::sharedDirector()->getWinSize(); m_iEachSizeDis = pClip->getContentSize().height / 4; if( CCDirector::sharedDirector()->getWinSize().width >= 1024 ) { m_iEachSizeHeight = size.height / 8; } else { m_iEachSizeHeight = size.height / 6; } // for( int i = 0; i < m_vTaskEvent.size(); i++ ) { CCNode* pNode = GetXMLNodeFromKey( "t2dSceneObject_achievement_icon" ); CCPoint CConverpos = pGroup->convertToNodeSpace( pNode->getPosition() ); string path = GetGameImagesPath(); path = path + m_vTaskEvent[i].eventIcon; CCSprite* pSprite = CCSprite::spriteWithFile( path.c_str() ); pSprite->setPosition( ccp( CConverpos.x, CConverpos.y - i* m_iEachSizeHeight ) ); m_pGroupNode->addChild( pSprite ); pNode = GetXMLNodeFromKey( "t2dSceneObject_achievement_bottom" ); CConverpos = pGroup->convertToNodeSpace( pNode->getPosition() ); path = GetGameImagesPath(); path = path + "Achievement_ytiao.png"; pSprite = CCSprite::spriteWithFile( path.c_str() ); pSprite->setPosition( ccp( CConverpos.x, CConverpos.y - i* m_iEachSizeHeight ) ); m_pGroupNode->addChild( pSprite ); string utf8; CChineseCode::GB2312ToUTF_8( utf8, ( char* )m_vTaskEvent[i].eventLog.c_str(), m_vTaskEvent[i].eventLog.length() ); CCLabelTTF *pLabel = CCLabelTTF::labelWithString( utf8.c_str(), kFontSystem[FONT_SMALL].fontName, kFontSystem[FONT_SMALL].fontSize ); pLabel->setPosition( ccp( CConverpos.x, CConverpos.y - i* m_iEachSizeHeight ) ); CCRenderTexture *pstroke = createStroke(pLabel, 1, kFontSystem[FONT_SMALL].strokeColor); m_pGroupNode->addChild( pstroke ); m_pGroupNode->addChild( pLabel ); pNode = GetXMLNodeFromKey( "t2dSceneObject_achievement_reward" ); CConverpos = pGroup->convertToNodeSpace( pNode->getPosition() ); path = GetGameImagesPath(); path = path + m_vTaskEvent[i].RunIcon; if( !m_vTaskEvent[i].RunIcon.empty() ) { pSprite = CCSprite::spriteWithFile( path.c_str() ); pSprite->setPosition( ccp( CConverpos.x, CConverpos.y - i* m_iEachSizeHeight ) ); m_pGroupNode->addChild( pSprite ); } char buffer[32]; sprintf( buffer, "+%d", m_vTaskEvent[i].targetNum ); pLabel = CCLabelTTF::labelWithString( buffer, kFontSystem[FONT_SMALL].fontName, kFontSystem[FONT_SMALL].fontSize ); pLabel->setPosition( ccp( CConverpos.x + pSprite->getContentSize().width / 2, CConverpos.y - i* m_iEachSizeHeight) ); pLabel->setAnchorPoint( ccp( 0, 0.5 ) ); pstroke = createStroke(pLabel, 1, kFontSystem[FONT_SMALL].strokeColor); m_pGroupNode->addChild( pstroke ); m_pGroupNode->addChild( pLabel ); } m_pUpScorl = ( CCSprite* )GetXMLNodeFromKey( "scorlup" ); m_pDownScorl= ( CCSprite* )GetXMLNodeFromKey( "scorldown" ); if( m_vTaskEvent.size() <= 4 ) { m_pUpScorl->setIsVisible( false ); m_pDownScorl->setIsVisible( false ); } else { m_pDownScorl->setIsVisible( true ); } setIsTouchEnabled( true ); }