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


C++ stringw类代码示例

本文整理汇总了C++中stringw的典型用法代码示例。如果您正苦于以下问题:C++ stringw类的具体用法?C++ stringw怎么用?C++ stringw使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: object

void World::readWaterIndex() {
	//filepath for the object file
	stringw path = WATER_INDEX;
	//the only tag in this file is the object tag to define a new object
	const stringw object("water");
	//initialize an XML reader
	io::IXMLReader* reader = Client::device->getFileSystem()->createXMLReader(path);

	//start the reading loop
	while (reader->read()) {
		  switch (reader->getNodeType()) {
			  //we found a new element
              case irr::io::EXN_ELEMENT:
				  //new <object> tag
				  if (object.equals_ignore_case(reader->getNodeName())) {
					  u16 id = reader->getAttributeValueAsInt(L"id");
					  u16 x = reader->getAttributeValueAsInt(L"x");
					  u16 y = reader->getAttributeValueAsInt(L"y");
					  u16 w = reader->getAttributeValueAsInt(L"w");
					  u16 l = reader->getAttributeValueAsInt(L"l");
					  float h = reader->getAttributeValueAsFloat(L"height");
					  water_index.push_back(WaterData(id, x, y,  w, l, h));
					  cout << "Water loaded " << id << " " << x << " " << y << " " << w << " " << l << " " << h << endl;
				  }
				  break;
		  }
	}

	//drop the xml reader
	reader->drop();
}
开发者ID:jake2008,项目名称:TBR_CLIENT,代码行数:31,代码来源:CWorld.cpp

示例2: executeConsoleEvent

// Execute Console Event
void ConsoleState::executeConsoleEvent(stringw val)
{
	val.make_lower();

	if(val=="statelog")
	{	_coreApp->addLogItem(val); _coreApp->toggleStateLog();	}
	else if(val=="debugmode")
	{	_coreApp->addLogItem(val); _coreApp->toggleDebugMode(); }
	else if(val=="exit")
	{	_coreApp->exitApplication();	}
	else if(val.subString(0,4) == "exec")
	{	
		_coreApp->addLogItem(val);

		irr::core::stringc stateRef = val.subString(5,val.size()-5);

		if(stateRef == "mainmenu")
		{
			_coreApp->addLogItem("@Main Menu State - Added to Stack");
			_coreApp->getStateManager()->add(new MainMenuState(_coreApp));
		}
	}
	else
	{	_coreApp->addLogItem("[ERROR] Unknown Command");	}

	_coreApp->getInputManager()->resetString();
}
开发者ID:IOjp,项目名称:Tetra-Irrlicht-Framework,代码行数:28,代码来源:ConsoleState.cpp

示例3: node_name

// ----------------------------------------------------------------------------
void Editor::writeResAndExePathIntoConfig()
{
    stringc p;
    IFileSystem* file_system = m_device->getFileSystem();
    IXMLReader*  xml_reader = file_system->createXMLReader(m_config_loc + "/config.xml");
    if (xml_reader)
    {
        const stringw node_name(L"data_dir");
        while (xml_reader->read())
        {
            if (xml_reader->getNodeType() == EXN_ELEMENT
                && node_name.equals_ignore_case(xml_reader->getNodeName()))
            {
                p = xml_reader->getAttributeValueSafe(L"path");
            }
        }
        xml_reader->drop();
    }

    std::ofstream f;
    f.open((m_config_loc + "/config.xml").c_str());
    f << "<config>\n";
    f << "  <data_dir path=\"" << p.c_str() << "\" />\n";

    if (!m_exe_loc.empty())
        f << "  <exe path=\"" << m_exe_loc.c_str() << "\" />\n";

    f << "  <res x=\"" << m_screen_size.Width << "\" y=\"";
    f << m_screen_size.Height << "\" />\n";
    f << "</config>\n";
    f.close();

} // writeResAndExePathIntoConfig
开发者ID:CruzR,项目名称:stk-editor,代码行数:34,代码来源:editor.cpp

示例4: GetCellFileSuffix

bool CGWIC_Cell::LoadObjectStates()
{
	path filenm = GWIC_CELLSTORE_DIR;
	filenm += GetCellFileSuffix();
	filenm += ".xml";
	IXMLReader* xml = graphics->getFileSystem()->createXMLReader(filenm);
	if (!xml) {
		std::cerr << "LoadObjectStates(): can't create xml reader for " << filenm.c_str() << std::endl;
		return false;
	}
	const stringw tg_obj(L"object");
	const stringw tg_pos(L"position");
	const stringw tg_opt(L"options");
	stringw cur_tag;
	path cfile;
	CIrrStrParser pos,rot,scl;
	CGWIC_GameObject* optr = NULL;
	while (xml->read()) {
		switch (xml->getNodeType()) {
		case EXN_ELEMENT:
			if ((cur_tag.empty()) && (tg_obj.equals_ignore_case(xml->getNodeName()))) {
				cur_tag = tg_obj;
				cfile = xml->getAttributeValueSafe(L"file");
				optr = new CGWIC_GameObject(cfile,GetCoord(),graphics,physics);
				if (!optr)
					std::cerr << "Failed to create object from " << cfile.c_str() << std::endl;
				else
					objects.push_back(optr);
			} else if ((cur_tag == tg_obj) && (optr)) {
				if (tg_pos.equals_ignore_case(xml->getNodeName())) {
					pos = xml->getAttributeValueSafe(L"pos");
					rot = xml->getAttributeValueSafe(L"rot");
					scl = xml->getAttributeValueSafe(L"scale");
					optr->SetPos(pos.ToVector3f());
					optr->SetScale(scl.ToVector3f());
					optr->SetRot(rot.ToVector3f());
				} else if (tg_pos.equals_ignore_case(xml->getNodeName())) {
					optr->SetPhysical(xml->getAttributeValueAsInt(L"physical"));
					optr->SetEnabled(xml->getAttributeValueAsInt(L"enabled"));
				}
			}
			break;
		case EXN_ELEMENT_END:
			cur_tag = L"";
			optr = NULL;
			break;
		default: break;
		}
	}
	xml->drop();
	return false;
}
开发者ID:matrixsmaster,项目名称:GWIC,代码行数:52,代码来源:CGWIC_Cell.cpp

示例5: showDialogQuestion

//Display a ingame question
bool GUIGame::showDialogQuestion(stringw text, std::string sound )
{

	IGUIStaticText* txt_dialog=(IGUIStaticText*)GUIManager::getInstance()->getGUIElement(GUIManager::TXT_ID_DIALOG);
	IGUIButton* guiBtDialogCancel=(IGUIButton*)GUIManager::getInstance()->getGUIElement(GUIManager::BT_ID_DIALOG_CANCEL);
	//Pause the player during the dialog opening
	DynamicObjectsManager::getInstance()->getPlayer()->setAnimation("idle");

	//stringw text2 = (stringw)text.c_str();
	txt_dialog->setText(text.c_str());
	if(!guiBtDialogCancel->isVisible())
		guiBtDialogCancel->setVisible(true);

	GUIManager::getInstance()->setWindowVisible(GUIManager::GCW_DIALOG,true);
	App::getInstance()->setAppState(App::APP_WAIT_DIALOG);

	//Play dialog sound (yes you can record voices!)
    dialogSound = NULL;

	if (sound.size()>0)
    //if((sound.c_str() != "") | (sound.c_str() != NULL))
    {
        stringc soundName = "../media/sound/";
        soundName += sound.c_str();
        dialogSound = SoundManager::getInstance()->playSound2D(soundName.c_str());
    }

	return true;
}
开发者ID:kcuzner,项目名称:irrrpgbuilder,代码行数:30,代码来源:CUIGame.cpp

示例6: setLabel

// -----------------------------------------------------------------------------
void IconButtonWidget::setLabel(const stringw& new_label)
{
    if (m_label == NULL) return;

    m_label->setText( new_label.c_str() );
    setLabelFont();
}
开发者ID:Cav098,项目名称:stk-code-fix_1797,代码行数:8,代码来源:icon_button_widget.cpp

示例7: addIcon

	/*
		Add another icon which the user can click and select as cursor later on.
	*/
	void addIcon(const stringw& name, const SCursorSprite &sprite, bool addCursor=true)
	{
		// Sprites are just icons - not yet cursors. They can be displayed by Irrlicht sprite functions and be used to create cursors.
		SpriteBox->addItem(name.c_str(), sprite.SpriteId);
		Sprites.push_back(sprite);

		// create the cursor together with the icon?
		if ( addCursor )
		{
			/* Here we create a hardware cursor from a sprite */
			Device->getCursorControl()->addIcon(sprite);

			// ... and add it to the cursors selection listbox to the other system cursors.
			CursorBox->addItem(name.c_str());
		}
	}
开发者ID:u-engine,项目名称:chihuahua,代码行数:19,代码来源:main.cpp

示例8:

/**
 * Advanced constructor. Used for pickable items placed in container objects loaded from map files.
 */
CGameObject::CGameObject(stringw _root, s32 _id, IXMLReader* xml, IVideoDriver* driver)
{
	s32 position = _root.findLastChar(L"/",1);
	stringc _name = _root.subString(position+1,_root.size()-position);
	stringc _path = _root.subString(0,position+1);

	animations.clear();
	m_ListOfAbilities_Default.clear();
	m_ListOfSkills_Default.clear();
	m_ListOfTrajectoryPaths.clear();
	isAnimated = false;
	name = _name;
	path = _path;
	root = _name;
	id = _id;
	isContainer = false;
	isMonster = false;
	isAnchored = false;
	isNPC = false;
	isPickable = false;
	isArea = false;
	isTrigger = false;
	isInvisible = false;
	isIllusion = false;
	isStatic = false;
	isTerrain = false;
	isTile = false;
	isWall = false;
	hasTrajectoryPath = false;
	isTrajectoryNode = false;
	trajectoryParent = NULL;
	m_IconTexture = 0;
	description = L"No description specified";
	script = _name + ".script"; //default, but can be different
	icon = _name + ".png"; //default, but can be different
	m_Driver = driver;
	nameID = 0;
	trajectoryPathFile = "";

	if(xml)
	{
		LoadPropertiesFromXMLFile(xml);
		xml->drop();
	}
}
开发者ID:bpetar,项目名称:leonline,代码行数:48,代码来源:GameObject.cpp

示例9: onNewPlayerWithName

void OptionsScreenPlayers::onNewPlayerWithName(const stringw& newName)
{
    ListWidget* players = this->getWidget<ListWidget>("players");
    if (players != NULL)
    {
        core::stringc newNameC(newName.c_str());
        players->addItem( newNameC.c_str(), translations->fribidize(newName) );
    }
}
开发者ID:PalashBansal,项目名称:stk-code,代码行数:9,代码来源:options_screen_players.cpp

示例10: setLabel

// -----------------------------------------------------------------------------
void IconButtonWidget::setLabel(stringw new_label)
{
    if (m_label == NULL) return;
    
    m_label->setText( new_label.c_str() );
    
    const bool word_wrap = (m_properties[PROP_WORD_WRAP] == "true");
    const int max_w = m_label->getAbsolutePosition().getWidth();
    
    if (!word_wrap &&
        (int)GUIEngine::getFont()->getDimension(new_label.c_str()).Width > max_w + 4) // arbitrarily allow for 4 pixels
    {
        m_label->setOverrideFont( GUIEngine::getSmallFont() );
    }
    else
    {
        m_label->setOverrideFont( NULL );
    }
}
开发者ID:kiennguyen1994,项目名称:game-programming-cse-hcmut-2012,代码行数:20,代码来源:icon_button_widget.cpp

示例11: updateProgressBar

void Game::updateProgressBar(int newValue, stringw msg) {
    progBar->setVisible(false);
    progBar = env->addImage(rect<int>(0, (cfg_settings.WindowSize.Height-68), (cfg_settings.WindowSize.Width*newValue)/100, (cfg_settings.WindowSize.Height-20)));
    progBar->setImage(driver->getTexture("textures/bars/progressbar_bar_720.png"));
        progBar->setUseAlphaChannel(true);
    progText->setText(msg.c_str());
    driver->beginScene(true, true, SColor(0, 0, 0, 0));
    env->drawAll();
    driver->endScene();

    }
开发者ID:selujtje,项目名称:mygame,代码行数:11,代码来源:resourceloader.cpp

示例12: submit

// -----------------------------------------------------------------------------
void ChangePasswordDialog::submit()
{
    const stringw current_password = m_current_password_widget->getText().trim();
    const stringw new_password1 = m_new_password1_widget->getText().trim();
    const stringw new_password2 = m_new_password2_widget->getText().trim();
    if (current_password.size() < 8 || current_password.size() > 30)
    {
        sfx_manager->quickSound("anvil");
        m_info_widget->setErrorColor();
        m_info_widget->setText(_("Current password invalid."), false);
    }
    else if (new_password1.size() < 8 || new_password1.size() > 30)
    {
        sfx_manager->quickSound("anvil");
        m_info_widget->setErrorColor();
        m_info_widget->setText(_("Password has to be between 8 and 30 characters long!"), false);
    }
    else if (new_password1 != new_password2)
    {
        sfx_manager->quickSound("anvil");
        m_info_widget->setErrorColor();
        m_info_widget->setText(_("Passwords don't match!"), false);
    }
    else
    {
        m_options_widget->setDeactivated();
        m_info_widget->setDefaultColor();
        Online::CurrentUser::get()->requestPasswordChange(current_password, new_password1, new_password2);
    }
}
开发者ID:Shreesha-S,项目名称:stk-code,代码行数:31,代码来源:change_password_dialog.cpp

示例13: zone

void ZoneSoundLoader::readZonesFromFile(){

	m_firstRun = true; // dont remove this :) in here for good execution flow

	// clear the zone_index vector
	m_zone_index.clear();

	// read from .dat file which contains zone boundaries
	stringw reader_path = SOUND_INDEX;
	io::IXMLReader* reader = Client::device->getFileSystem()->createXMLReader(reader_path);

	const stringw zone("zone");

	// read through the zones
	while (reader->read()){

		switch (reader->getNodeType()) {
			// if new zone is found..
		case irr::io::EXN_ELEMENT:
			//new <object> tag
			if (zone.equals_ignore_case(reader->getNodeName())) {
				u16 id = reader->getAttributeValueAsInt(L"id");
				u16 x = reader->getAttributeValueAsInt(L"x");
				u16 z = reader->getAttributeValueAsInt(L"z");
				u16 tox = reader->getAttributeValueAsInt(L"tox");
				u16 toz = reader->getAttributeValueAsInt(L"toz");
				//stringw name = reader->getAttributeValue(L"name");
				const wchar_t* songName = reader->getAttributeValue(L"songName");
				const wchar_t* name = reader->getAttributeValue(L"name");
				wstring sN(songName);
				//std::cout << "Song name:" << endl;
				//std::wcout << sN.c_str() << endl;
				// push the object to a vector
				m_zone_index.push_back(ZoneData(id, x, z, tox, toz, name, songName));
			}
			break;
		}

	}
}
开发者ID:jake2008,项目名称:TBR_CLIENT,代码行数:40,代码来源:CZoneSoundLoader.cpp

示例14: login

/** Collects the data entered into the gui and submits a login request.
 *  The login request is processes asynchronously b the ReqeustManager.
 */
void LoginScreen::login()
{
    // Reset any potential error message shown.
    LabelWidget *info_widget = getWidget<LabelWidget>("info");
    info_widget->setDefaultColor();
    info_widget->setText("", false);

    const stringw username = getWidget<TextBoxWidget>("username")
                            ->getText().trim();
    const stringw password = getWidget<TextBoxWidget>("password")
                            ->getText().trim();

    if (username.size() < 4 || username.size() > 30 || 
        password.size() < 8 || password.size() > 30    )
    {
        sfx_manager->quickSound("anvil");
        info_widget->setErrorColor();
        info_widget->setText(_("Username and/or password too short or too long."),
                             false);
    }
    else
    {
        m_options_widget->setDeactivated();
        info_widget->setDefaultColor();
        bool remember = getWidget<CheckBoxWidget>("remember")->getState();
        Online::CurrentUser::get()->requestSignIn(username,password, 
                                                  remember           );
    }
}   // login
开发者ID:Shreesha-S,项目名称:stk-code,代码行数:32,代码来源:login_screen.cpp

示例15: file

// ----------------------------------------------------------------------------
std::list<stringc> Editor::readRecentlyOpenedList()
{
    std::list<stringc> list;

    IFileSystem* file_system = m_device->getFileSystem();
    IXMLReader*  xml_reader = file_system->createXMLReader(m_config_loc + "/recent.xml");

    stringc s;
    if (xml_reader)
    {
        const stringw file(L"file");
        while (xml_reader->read())
        {
            if (xml_reader->getNodeType() == EXN_ELEMENT
                && file.equals_ignore_case(xml_reader->getNodeName()))
            {
                s  = xml_reader->getAttributeValueSafe(L"name");
                list.push_back(s);
            }
        }
        xml_reader->drop();
    }
    return list;
} // readRecentlyOpenedList
开发者ID:CruzR,项目名称:stk-editor,代码行数:25,代码来源:editor.cpp


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