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


C++ UTFString::empty方法代码示例

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


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

示例1: SendPrivateChat

void SendPrivateChat(int target_uid, Ogre::UTFString chatline, Ogre::UTFString target_username)
{
#ifdef USE_SOCKETW
	char buffer[MAX_MESSAGE_LENGTH] = {0};
	
	const char *chat_msg = (const char *)chatline.asUTF8_c_str();

	// format: int of UID, then chat message
	memcpy(buffer, &target_uid, sizeof(int));
	strncpy(buffer + sizeof(int), chat_msg, MAX_MESSAGE_LENGTH - sizeof(int));

	size_t len = sizeof(int) + chatline.size() * sizeof(wchar_t);
	buffer[len] = 0;

	RoR::Networking::AddPacket(m_stream_id, MSG2_UTF_PRIVCHAT, (unsigned int)len, buffer);

	if (target_username.empty())
	{
		user_info_t user;
		if (RoR::Networking::GetUserInfo(target_uid, user))
		{
			target_username = GetColouredName(user.username, user.colournum);
		}
	}

	// add local visual
	Ogre::UTFString local_username = GetColouredName(RoR::Networking::GetUsername(), RoR::Networking::GetUserColor());
	Ogre::UTFString nmsg = local_username + RoR::Color::WhisperColour + _L(" [whispered to ") + RoR::Color::NormalColour + target_username + RoR::Color::WhisperColour + "]" + RoR::Color::NormalColour + ": " + chatline;
#ifdef USE_MYGUI
	RoR::Application::GetGuiManager()->pushMessageChatBox(nmsg);
#endif // USE_MYGUI
#endif // USE_SOCKETW
}
开发者ID:adriansnetlis,项目名称:rigs-of-rods,代码行数:33,代码来源:ChatSystem.cpp

示例2: SelectObject

bool EditorFrameHandler::SelectObject(Ogre::UTFString name)
{
	MyGUI::Gui *gui = GUISystem::GetInstance()->GetGui();
	if (ObjectDescription)
	{
		//ObjectDescription->Hide();
		//gui->destroyWidget(ObjectDescription.get());
		ObjectDescription->Destroy();		
	}
	if (SelectedObjectName == name || name.empty())
	{
		delete ObjectDescription;
		ObjectDescription = NULL;
		return false;
	}

	std::map<Ogre::UTFString, SEditableDescription>::iterator iRes = EditorNodes.find(name);
	assert(EditorNodes.end()!=iRes);
	if (EditorNodes.end()!=iRes)
	{
		SelectedObjectName = name;
		SelectedObject = &iRes->second;
		ObjectDescription = new ObjectDescriptionLayout("EditorObjectOptions.layout");
		ObjectDescription->Load();
		ObjectDescription->Parse(SelectedObject->EditElement);
		ObjectDescription->Show();
	}
	return true;
}
开发者ID:beorc,项目名称:flare_star,代码行数:29,代码来源:EditorFrameHandler.cpp

示例3: sendPrivateChat

void ChatSystem::sendPrivateChat(int target_uid, Ogre::UTFString chatline, Ogre::UTFString username)
{
#ifdef USE_SOCKETW
	char buffer[MAX_MESSAGE_LENGTH] = "";
	
	const char *chat_msg = (const char *)chatline.asUTF8_c_str();

	// format: int of UID, then chat message
	memcpy(buffer, &target_uid, sizeof(int));
	strncpy(buffer + sizeof(int), chat_msg, MAX_MESSAGE_LENGTH - sizeof(int));

	size_t len = sizeof(int) + chatline.size() * sizeof(wchar_t);
	buffer[len] = 0;

	this->addPacket(MSG2_UTF_PRIVCHAT, (unsigned int)len, buffer);

	if(username.empty())
	{
		client_t *c = net->getClientInfo(target_uid);
		if(c) username = getColouredName(*c);
	}

	// add local visual
#ifdef USE_MYGUI
	UTFString nmsg = net->getNickname(true) + normalColour + whisperColour + _L(" [whispered to ") + normalColour + username + whisperColour + "]" + normalColour + ": " + chatline;
	Console::getInstance().putMessage(Console::CONSOLE_MSGTYPE_NETWORK, Console::CONSOLE_LOCAL_CHAT, nmsg, "script_key.png");
#endif // USE_MYGUI
#endif // USE_SOCKETW
}
开发者ID:Winceros,项目名称:main,代码行数:29,代码来源:ChatSystem.cpp

示例4: getHomeDirectory

Ogre::UTFString GameRootLinux::getHomeDirectory()
{
    Ogre::UTFString homeDir;
    homeDir = Ogre::UTFString(getenv("HOME"));
    if (homeDir.empty())
    {
        struct passwd *pw = getpwuid(getuid());
        homeDir = Ogre::UTFString(pw->pw_dir);
    }
    return homeDir + Ogre::UTFString("/.hardwar");
}
开发者ID:9981juhehua,项目名称:Hardwar,代码行数:11,代码来源:GameRootLinux.cpp

示例5: eventCommandAccept

void CLASS::eventCommandAccept(MyGUI::Edit* _sender)
{
	Ogre::UTFString msg = convertFromMyGUIString(_sender->getCaption());
	isTyping = false;
	_sender->setCaption("");

	if (autoHide)
		_sender->setEnabled(false);

	if (msg.empty())
	{
		// discard the empty message
		return;
	}

	if (msg[0] == '/' || msg[0] == '\\')
	{
		Ogre::StringVector args = Ogre::StringUtil::split(msg, " ");
		if (args[0] == "/whisper")
		{
			if (args.size() != 3)
			{
				pushMsg("usage: /whisper username message");
				return;
			}
			netChat->sendPrivateChat(args[1], args[2]);
			return;
		}
	}

	if (gEnv->network && netChat)
	{
		netChat->sendChat(msg.c_str());
		return;
	}

	//MyGUI::InputManager::getInstance().resetKeyFocusWidget();
	RoR::Application::GetGuiManager()->UnfocusGui();
}
开发者ID:Clever-Boy,项目名称:rigs-of-rods,代码行数:39,代码来源:GUI_GameChatBox.cpp

示例6: cutMaxLengthFromBeginning

	void TextIterator::cutMaxLengthFromBeginning(size_t _max)
	{
		// узнаем размер без тегов
		size_t size = getSize();
		if (size <= _max) return;

		// разница 
		size_t diff = size - _max;

		// последний цвет
		Ogre::UTFString::iterator iter_colour = mEnd;

		// теперь пройдем от начала и узнаем реальную позицию разницы
		Ogre::UTFString::iterator iter=mText.begin();
		for (; iter!=mEnd; ++iter)
		{
			if ((*iter) == L'#')
			{
				Ogre::UTFString::iterator save = iter;

				// следующий символ
				++ iter;
				if (iter == mEnd) break;

				// тэг цвета
				if ((*iter) != L'#')
				{
					// остальные 5 символов цвета
					for (size_t pos=0; pos<5; pos++)
					{
						++ iter;
						if (iter == mEnd)
						{
							-- iter;
							break;
						}
					}
					// сохраняем цвет
					iter_colour = save;
				}
				continue;
			}
			// обычный символ был
			if (diff == 0) break;
			-- diff;
		}

		Ogre::UTFString colour;
		// если бы цвет, то вставляем назад
		if (iter_colour != mEnd)
		{
			colour.append(iter_colour, iter_colour + size_t(7));
		}

		mCurrent = erase(mText.begin(), iter);
		mEnd = mText.end();
		mSave = mText.end(); //FIXME
		mPosition = 0;
		mSize = _max;

		if ( ! colour.empty() ) setTagColour(colour);

	}
开发者ID:venkatarajasekhar,项目名称:viper,代码行数:63,代码来源:MyGUI_TextIterator.cpp


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