当前位置: 首页>>代码示例>>C++>>正文


C++ JString::UTF8Representation方法代码示例

本文整理汇总了C++中JString::UTF8Representation方法的典型用法代码示例。如果您正苦于以下问题:C++ JString::UTF8Representation方法的具体用法?C++ JString::UTF8Representation怎么用?C++ JString::UTF8Representation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JString的用法示例。


在下文中一共展示了JString::UTF8Representation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: debugReturn

void LoadBalancingListener::debugReturn(const JString& string)
{
	std::wcerr << string << std::endl;
#ifdef _EG_ANDROID_PLATFORM
	__android_log_print(ANDROID_LOG_INFO, "DemoParticle", "%s", string.UTF8Representation().cstr());
#endif
}
开发者ID:Dezlan,项目名称:EchoBlade,代码行数:7,代码来源:LoadBalancingListener.cpp

示例2: leaveRoomReturn

void LoadBalancingListener::leaveRoomReturn(int errorCode, const JString& errorString)
{
	updateState();
	if(errorCode == ErrorCode::OK)
		mpView->info("game room has been successfully left");
	else
		mpView->info("opLeaveRoom() failed: %s", errorString.UTF8Representation().cstr());
	mpView->initPlayers();
}
开发者ID:Dezlan,项目名称:EchoBlade,代码行数:9,代码来源:LoadBalancingListener.cpp

示例3: joinRoomReturn

void LoadBalancingListener::joinRoomReturn(int localPlayerNr, const Hashtable& gameProperties, const Hashtable& playerProperties, int errorCode, const JString& errorString)
{
	updateState();
	if(errorCode == ErrorCode::OK)
	{
		mpView->info("game room has been successfully joined");
		afterRoomJoined(localPlayerNr);
	}
	else
		mpView->info("opJoinRoom() failed: %s", errorString.UTF8Representation().cstr());
}
开发者ID:Dezlan,项目名称:EchoBlade,代码行数:11,代码来源:LoadBalancingListener.cpp

示例4: connectReturn

void LoadBalancingListener::connectReturn(int errorCode, const JString& errorString)
{
	updateState();
	if(errorCode == ErrorCode::OK)
	{
		mpView->info("connected");
		mpLbc->opJoinRandomRoom();
	}
	else
		mpView->warn("Warn: connect failed %d %s", errorCode, errorString.UTF8Representation().cstr());
}
开发者ID:Dezlan,项目名称:EchoBlade,代码行数:11,代码来源:LoadBalancingListener.cpp

示例5: eventConnected

void CCLobbyView::eventConnected( cocos2d::CCObject* sender )
{
    JString userName = "";
    CocosNetworkLogic* network = CocosNetworkLogic::getInstance();
    CCEditBox *eb = this->getEditName();
    const char* ebtext = eb->getText();
    if (strlen(ebtext) != 0) {
        userName = ebtext;
        network->setUserName(userName);
    } else {
        userName = network->getUserName();
        eb->setText(userName.UTF8Representation().cstr());
    }
}
开发者ID:kaznog,项目名称:t09,代码行数:14,代码来源:CCLobbyView.cpp

示例6: initTopMenu

bool CCLobbyView::initTopMenu()
{
    CCDirector* director = CCDirector::sharedDirector();
    const CCSize winSize = director->getWinSize();
    const CCSize mySize = this->getContentSize();
    const CCPoint center = ccpMult( ccpFromSize( mySize ), 0.5f );
    
    CCLabelTTF* consoleLabel = CCLabelTTF::create( "disconnected", "Arial", FONT_SIZE(24), CCSizeMake( winSize.width, FONT_SIZE(24) ), kCCTextAlignmentCenter );
    consoleLabel->setColor( ccc3(255, 255, 255) );
    CCMenuItemLabel* consoleItem = CCMenuItemLabel::create( consoleLabel );
    
    // bottom
    const CCSize editSize = CCSizeMake( winSize.width, FONT_SIZE(48) );
    CCMenuItem* editItem = CCMenuItem::create();
    editItem->setContentSize( editSize );
    
    CCMenu* topMenu = CCMenu::create( consoleItem, editItem, NULL );
    if( topMenu )
    {
        this->setConsole( consoleLabel );
        
        topMenu->alignItemsVertically();
        topMenu->setPosition( CCPointMake( center.x, winSize.height - (editItem->getContentSize().height + consoleItem->getContentSize().height)/2 ) );
        this->addChild( topMenu, 0, Child::CCMenu_topMenu );
        
        const CCPoint editItemPosition = editItem->getParent()->convertToWorldSpace( editItem->getPosition() );
        editItem->setContentSize( winSize );
        editItem->ignoreAnchorPointForPosition( false );
        editItem->setAnchorPoint( ccp( 0.5f, (winSize.height / (editItemPosition.y - winSize.height)) * 0.5f ) );
        
        CCScale9Sprite* editSprite = CCScale9Sprite::create("extensions/yellow_edit.png");
        CCEditBox* edit = CCEditBox::create( editSize, editSprite );
        edit->setPlaceHolder("PlayerName");
        edit->setReturnType(kKeyboardReturnTypeDone);
        edit->setFontColor(ccGRAY);
        edit->setMaxLength( 20 );
        edit->setDelegate(this);
        edit->setTouchEnabled( true );
        edit->setPosition( editItemPosition );
        CocosNetworkLogic* network = CocosNetworkLogic::getInstance();
        JString userName = network->getUserName();
        edit->setText(userName.UTF8Representation().cstr());
        this->addChild( edit );
        this->setEditName(edit);
    }
    
    return topMenu;
}
开发者ID:kaznog,项目名称:t09,代码行数:48,代码来源:CCLobbyView.cpp


注:本文中的JString::UTF8Representation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。