本文整理汇总了C++中CCLabelAtlas::initWithString方法的典型用法代码示例。如果您正苦于以下问题:C++ CCLabelAtlas::initWithString方法的具体用法?C++ CCLabelAtlas::initWithString怎么用?C++ CCLabelAtlas::initWithString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCLabelAtlas
的用法示例。
在下文中一共展示了CCLabelAtlas::initWithString方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create
CCLabelAtlas* CCLabelAtlas::create(const char *string, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned int startCharMap)
{
CCLabelAtlas *pRet = new CCLabelAtlas();
if(pRet && pRet->initWithString(string, charMapFile, itemWidth, itemHeight, startCharMap))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
示例2: CCLabelAtlas
//CCLabelAtlas - Creation & Init
CCLabelAtlas * CCLabelAtlas::labelWithString(const char *label, StreamSource* charMapSource, unsigned int itemWidth, int unsigned itemHeight, unsigned char startCharMap)
{
CCLabelAtlas *pRet = new CCLabelAtlas();
if(pRet && pRet->initWithString(label, charMapSource, itemWidth, itemHeight, startCharMap))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet)
return NULL;
}
示例3: initFromString
bool CCMenuItemAtlasFont::initFromString(const char *value, const char *charMapFile, int itemWidth, int itemHeight, char startCharMap, SelectorProtocol* target, SEL_MenuHandler selector)
{
NSAssert( value != NULL && strlen(value) != 0, "value length must be greater than 0");
CCLabelAtlas *label = new CCLabelAtlas();
label->initWithString(value, charMapFile, itemWidth, itemHeight, startCharMap);
label->autorelease();
if (CCMenuItemLabel::initWithLabel(label, target, selector))
{
// do something ?
}
return true;
}
示例4: CCLabelAtlas
NS_CC_BEGIN
//CCLabelAtlas - Creation & Init
CCLabelAtlas * CCLabelAtlas::labelWithString(const char *label, const char *charMapFile, unsigned int itemWidth, int unsigned itemHeight, unsigned char startCharMap)
{
CCLabelAtlas *pRet = new CCLabelAtlas();
if(pRet && pRet->initWithString(label, charMapFile, itemWidth, itemHeight, startCharMap))
{
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
示例5: CCLabelAtlas
NS_CC_BEGIN
//CCLabelAtlas - Creation & Init
CCLabelAtlas * CCLabelAtlas::create(const char *string, const char *charMapFile, unsigned int itemWidth, unsigned int itemHeight, unsigned int startCharMap, float space)
{
CCLabelAtlas *pRet = new CCLabelAtlas();
if(pRet)
{
pRet->m_space = space;
pRet->initWithString(string, charMapFile, itemWidth, itemHeight, startCharMap);
pRet->autorelease();
return pRet;
}
CC_SAFE_DELETE(pRet);
return NULL;
}
示例6: displayRanking
////////////////////////////////////////////////////////////////////////////////
/// \brief Rangking 값을 읽어와 표시
////////////////////////////////////////////////////////////////////////////////
void JS_Result::displayRanking(float dt)
{
// CCUserDefault 에서 key값으로 랭킹값을 읽어서 순위를 표시한다.
SANG_GAME_RANK rank[JS_MAX_RANK];
SANG_RANK_KEY key[JS_MAX_RANK];
for ( int k = 0; k < JS_MAX_RANK; k++ )
{
if ( EASY == m_nGameLevel )
{
sprintf(key[k].rank_key, "js_easy_rank%d", k+1);
sprintf(key[k].time_key, "js_easy_time%d", k+1);
sprintf(key[k].date_key, "js_easy_date%d", k+1);
}
else
{
sprintf(key[k].rank_key, "js_hard_rank%d", k+1);
sprintf(key[k].time_key, "js_hard_time%d", k+1);
sprintf(key[k].date_key, "js_hard_date%d", k+1);
}
}
int nTime = 0;
std::string strZero = "0";
// Get Rank data
for ( int r = 0; r < JS_MAX_RANK; r++ )
{
sprintf(rank[r].rank, "%d", r+1);
nTime = CCUserDefault::sharedUserDefault()->getIntegerForKey(key[r].time_key);
sprintf(rank[r].time, "%d", nTime);
sprintf(rank[r].date, "%d", nTime);//CCUserDefault::sharedUserDefault()->getStringForKey(key[r].date_key, strZero.c_str()).c_str());
}
int nTemp = 0;
for ( int i = 0; i < JS_MAX_RANK; i++ )
{
nTemp = atof(rank[i].time);
if ( nTemp != 0 && nTemp >= m_nPlayTime || nTemp == 0)
{
//int nRet = 0;
if (nTemp != 0 && nTemp != m_nPlayTime)
{
for ( int k = JS_MAX_RANK-1; k > i; k-- )
{
sprintf(rank[k].date, "%s", rank[k-1].date);
sprintf(rank[k].time, "%s", rank[k-1].time);
}
}
time_t t = time(0);
struct tm *aTime = localtime(&t);
// Month is 0 - 11, add 1 to get a jan-dec 1-12 concept
// Year is # years since 1900
sprintf(rank[i].date, "%04d-%02d-%02d", aTime->tm_year + 1900, aTime->tm_mon + 1 , aTime->tm_mday);
sprintf(rank[i].time, "%d", m_nPlayTime);
m_nRank = i + 1;
// Update Rank Data
for ( int u = 0; u < JS_MAX_RANK; u++ )
{
CCUserDefault::sharedUserDefault()->setIntegerForKey(key[u].rank_key, u+1);
CCUserDefault::sharedUserDefault()->setStringForKey(key[u].time_key, rank[u].time);
CCUserDefault::sharedUserDefault()->setStringForKey(key[u].date_key, rank[u].date);
}
CCUserDefault::sharedUserDefault()->flush();
break;
}
m_nRank = -1; // 순위 밖
}
char cRankData[100];
for ( int i = 0; i < JS_MAX_RANK; i++ )
{
// 랭킹 데이터 출력
CCLabelAtlas *pRankLabel = new CCLabelAtlas();
if ( atof(rank[i].rank) < 10 && atof(rank[i].time) < 10 )
sprintf(cRankData,"%s %s %s",rank[i].rank, rank[i].time, rank[i].date);
else if ( atof(rank[i].rank) < 10 && atof(rank[i].time) >= 10 )
sprintf(cRankData,"%s %s %s",rank[i].rank, rank[i].time, rank[i].date);
else if ( atof(rank[i].rank) >= 10 && atof(rank[i].time) < 10 )
sprintf(cRankData,"%s %s %s",rank[i].rank, rank[i].time, rank[i].date);
else
sprintf(cRankData,"%s %s %s",rank[i].rank, rank[i].time, rank[i].date);
if ( m_nRank == i + 1 )
pRankLabel->initWithString(cRankData, "common/game/num_font_red.png", 24, 32, '0');
else
pRankLabel->initWithString(cRankData, "common/game/num_font_white.png", 24, 32, '0');
CCPoint ptRankData;
ptRankData.x = RANK_X;
ptRankData.y = RANK_Y - (pRankLabel->getContentSize().height * i);
pRankLabel->setPosition(ptRankData);
this->addChild(pRankLabel, 400+i);
//.........这里部分代码省略.........