本文整理汇总了C++中stringw::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ stringw::c_str方法的具体用法?C++ stringw::c_str怎么用?C++ stringw::c_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stringw
的用法示例。
在下文中一共展示了stringw::c_str方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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());
}
}
示例3: setLabel
// -----------------------------------------------------------------------------
void IconButtonWidget::setLabel(const stringw& new_label)
{
if (m_label == NULL) return;
m_label->setText( new_label.c_str() );
setLabelFont();
}
示例4: 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) );
}
}
示例5: 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 );
}
}
示例6: 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();
}
示例7: onNewPlayerWithName
void StoryModeLobbyScreen::onNewPlayerWithName(const stringw& newName)
{
bool slot_found = false;
PtrVector<PlayerProfile>& players = UserConfigParams::m_all_players;
for (int n=0; n<players.size(); n++)
{
if (players[n].getName() == newName)
{
unlock_manager->setCurrentSlot(players[n].getUniqueID());
unlock_manager->updateActiveChallengeList();
slot_found = true;
break;
}
}
if (!slot_found)
{
fprintf(stderr, "[StoryModeLobbyScreen] ERROR: cannot find player corresponding to slot '%s'\n",
core::stringc(newName.c_str()).c_str());
}
StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
}
示例8: showInputQuestion
//Need to be reworked: BAD. Render loop is done here!
stringc GUIGame::showInputQuestion(stringw text)
{
std::string newtxt = "";
bool mouseExit = false;
while(!App::getInstance()->isKeyPressed(KEY_RETURN) && mouseExit==false && App::getInstance()->getDevice()->run())
{
u32 timercheck = App::getInstance()->getDevice()->getTimer()->getRealTime();
App::getInstance()->getDevice()->getVideoDriver()->beginScene(true, true, SColor(0,200,200,200));
App::getInstance()->getDevice()->getSceneManager()->drawAll();
//guienv->drawAll();
App::getInstance()->getDevice()->getVideoDriver()->draw2DRectangle(SColor(150,0,0,0), rect<s32>(10,
App::getInstance()->getDevice()->getVideoDriver()->getScreenSize().Height - 200,
App::getInstance()->getDevice()->getVideoDriver()->getScreenSize().Width - 10,
App::getInstance()->getDevice()->getVideoDriver()->getScreenSize().Height - 10));
rect<s32> textRect = rect<s32>(10, App::getInstance()->getDevice()->getVideoDriver()->getScreenSize().Height - 180,
App::getInstance()->getDevice()->getVideoDriver()->getScreenSize().Width - 10,
App::getInstance()->getDevice()->getVideoDriver()->getScreenSize().Height - 10);
stringw realTxt = stringw(text.c_str());
realTxt += stringw(newtxt.c_str());
// Flashing cursor, flash at 1/4 second interval (based on realtime)
if((timercheck-timer2>250))
{
realTxt += L'_';
if (timercheck-timer2>500)
timer2=timercheck;
}
GUIManager::getInstance()->guiFontDialog->draw(realTxt.c_str(),textRect,SColor(255,255,255,255),false,false,&textRect);
//draw YES GREEN button
position2di buttonYesPosition = position2di(App::getInstance()->getDevice()->getVideoDriver()->getScreenSize().Width - 58,
App::getInstance()->getDevice()->getVideoDriver()->getScreenSize().Height - 58);
App::getInstance()->getDevice()->getVideoDriver()->draw2DImage(guiDialogImgYes,buttonYesPosition,
rect<s32>(0,0,48,48),0,SColor(255,255,255,255),true);
//check mouse click on OK button
position2di mousePos = App::getInstance()->getDevice()->getCursorControl()->getPosition();
if(mousePos.getDistanceFrom(buttonYesPosition+position2di(16,16)) < 16 && App::getInstance()->isMousePressed(0)) mouseExit = true;
//verify pressed chars and add it to the string
if(timercheck-timer > 160)
{
//process all keycodes [0-9] and [A-Z]
for(int i=0x30;i<0x5B;i++)
{
if(App::getInstance()->isKeyPressed(i))
{
newtxt += i;
timer = timercheck;
}
}
//process delete and backspace (same behavior for both of them -> remove the last char)
if(App::getInstance()->isKeyPressed(KEY_BACK) || App::getInstance()->isKeyPressed(KEY_DELETE))
{
newtxt = newtxt.substr(0,newtxt.size()-1);
timer = timercheck;
}
}
App::getInstance()->getDevice()->getVideoDriver()->endScene();
}
//EventReceiver::getInstance()->flushKeys();
//EventReceiver::getInstance()->flushMouse();
GUIManager::getInstance()->flush();
return stringc(newtxt.c_str());
}
示例9: createTank
void CRaycastTankExample::createTank(const stringw file, const stringw collFile, const vector3df &pos, const f32 mass)
{
IAnimatedMeshSceneNode *Node = device->getSceneManager()->addAnimatedMeshSceneNode(
device->getSceneManager()->getMesh(file.c_str()));
Node->setPosition(pos);
//Node->setRotation(vector3df(-40,90,0));
Node->setMaterialFlag(video::EMF_LIGHTING, true);
//Node->setScale(vector3df(2,2,4));
IGImpactMeshShape *shape = new IGImpactMeshShape(Node, device->getSceneManager()->getMesh(collFile.c_str()), mass);
tank = world->addRigidBody(shape);
// When using a raycast vehicle, we don't want this rigid body to deactivate.
tank->setActivationState(EAS_DISABLE_DEACTIVATION);
// Set some damping on the rigid body because the raycast vehicles tend to bounce a lot without a lot of tweaking.
// (cheap fix for the example only)
tank->setDamping(0.4, 0.4);
// We create our vehicle, passing our newly created rigid body as a parameter.
vehicle = world->addRaycastVehicle(tank);
// Set up our wheel construction info. These values can be changed for each wheel,
// and the values that you want to keep will stay the same, that way
// all parameters for each wheel can stay the same for what needs to remain equal,
// such as directions and suspension rest length.
SWheelInfoConstructionInfo wheel;
wheel.chassisConnectionPointCS = vector3df(0.0,-0.88,4.0);
wheel.wheelDirectionCS = vector3df(0.0,-0.1,0.0);
wheel.wheelAxleCS = vector3df(-0.5,0.0,0.0);
wheel.suspensionRestLength = 0.6;
wheel.wheelRadius = 8.0;
wheel.isFrontWheel = true;
// The bones are in the center of the mesh on the X axis, so we just set the width ourselves.
// Do the left row of wheels.
for(u32 i=0; i < Node->getJointCount(); i++)
{
// The bones that we need in this mesh are all named "RoadWheels" with a numerical suffix.
// So we do a quick check to make sure that no unwanted bones get through as wheels.
if(Node->getJointNode(i)->getName()[0] == 'R')
{
wheel.chassisConnectionPointCS = vector3df(-4, Node->getJointNode(i)->getPosition().Y,Node->getJointNode(i)->getPosition().Z);
vehicle->addWheel(wheel);
}
}
wheel.wheelAxleCS = vector3df(0.5,0.0,0.0);
// Do the right row of wheels.
for(u32 i=0; i < Node->getJointCount(); i++)
{
if(Node->getJointNode(i)->getName()[0] == 'R')
{
wheel.chassisConnectionPointCS = vector3df(4, Node->getJointNode(i)->getPosition().Y,Node->getJointNode(i)->getPosition().Z);
vehicle->addWheel(wheel);
}
}
for (u32 i=0;i<vehicle->getNumWheels();i++)
{
SWheelInfo &info = vehicle->getWheelInfo(i);
info.suspensionStiffness = 0.08f;
info.wheelDampingRelaxation = 20.0f;
info.wheelDampingCompression = 20.0f;
info.frictionSlip = 1000;
info.rollInfluence = 0.1f;
// We call updateWheel, which takes SWheelInfo as the first parameter,
// and the ID of the wheel to apply that info to. This must
// be called after any changes in order for the changes to actually take effect.
vehicle->updateWheelInfo(i);
}
}
示例10: logWindowMessage
// TODO: Make private? (Game needs to reach it, currently, in addAgent().)
void logWindowMessage( const stringw text )
{ logWindow->addItem( text.c_str() ); }// logMessage()
示例11: setWindowTitle
void PhysicsSim::setWindowTitle(stringw windowTitle)
{
dvc->setWindowCaption(windowTitle.c_str());
}
示例12: btDbvtBroadphase
PhysicsSim::PhysicsSim(stringw windowTitle, uint width, uint height, bool render)
{
broadphase = new btDbvtBroadphase();
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
btGImpactCollisionAlgorithm::registerAlgorithm(dispatcher);
solver = new btSequentialImpulseConstraintSolver;
dynamicsWorld = new btDiscreteDynamicsWorld(dispatcher,broadphase,solver,collisionConfiguration);
setGravity(9.8);
SIrrlichtCreationParameters params = SIrrlichtCreationParameters();
params.EventReceiver = this;
#ifndef NO_GRAPHICS
if(render)
{
params.Vsync = true;
params.DriverType = video::EDT_OPENGL;
params.WindowSize = core::dimension2d<u32>(width, height);
params.Fullscreen = true;
params.AntiAlias = 4;
params.Stencilbuffer = false;
}
else
params.DriverType = video::EDT_NULL;
#else
params.DriverType = video::EDT_NULL;
#endif
dvc = createDeviceEx(params);
dvc->getLogger()->setLogLevel(ELL_INFORMATION);
dvc->setWindowCaption(windowTitle.c_str());
dvc->getCursorControl()->setVisible(false);
driver = dvc->getVideoDriver();
smgr = dvc->getSceneManager();
env = dvc->getGUIEnvironment();
pipImage = env->addImage(recti(10,10,200,200));
pipImage->setScaleImage(true);
pipImage->setUseAlphaChannel(false);
pipImage->setVisible(false);
for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
KeyIsDown[i] = false;
lasttick = 0;
paused = false;
testSphere = NULL;
terrain = NULL;
mediaDirectory = L"./";
srand(time(NULL));
}
示例13: c_str
const wchar_t* c_str() const { return m_value.c_str(); }
示例14: main
//.........这里部分代码省略.........
playerPosition.Y = KAT_Y[HEDEFKAT];
player->setPosition(playerPosition);
BULUNDUGUM_KAT = HEDEFKAT;
str = L"DEVAM'A BASIN";
}
}
if(HEDEFKAT == 0)
Current = BASLANGIC0;
if(HEDEFKAT == 1)
Current = BASLANGIC1;
if(HEDEFKAT == 2)
Current = BASLANGIC2;
}
if(playerPosition.Z > 1350){
str = L"KAT:";
str += BULUNDUGUM_KAT;
str += L" > DOGU KORIDORU";
char a[2];
sprintf(a,"%d",BULUNDUGUM_KAT);
StringDATA[0]= '\0';
strcat(StringDATA,"KAT:");
strcat(StringDATA,a);
strcat(StringDATA," > DOGU KORIDORU");
}
if(playerPosition.Z < -860){
str = L"KAT:";
str += BULUNDUGUM_KAT;
str += L" > BATI KORIDORU";
char a[2];
sprintf(a,"%d",BULUNDUGUM_KAT);
StringDATA[0]= '\0';
strcat(StringDATA,"KAT:");
strcat(StringDATA,a);
strcat(StringDATA," > BATI KORIDORU");
}
if(playerPosition.Z > -860 && playerPosition.Z < 1350 && playerPosition.X < -480){
str = L"KAT:";
str += BULUNDUGUM_KAT;
str += L" > KUZEY KORIDORU";
char a[2];
sprintf(a,"%d",BULUNDUGUM_KAT);
StringDATA[0]= '\0';
strcat(StringDATA,"KAT:");
strcat(StringDATA,a);
strcat(StringDATA," > KUZEY KORIDORU");
}
if(playerPosition.Z > -860 && playerPosition.Z < 1350 && playerPosition.X > 780){
str = L"KAT:";
str += BULUNDUGUM_KAT;
str += L" > GUNEY KORIDORU";
char a[2];
sprintf(a,"%d",BULUNDUGUM_KAT);
StringDATA[0]= '\0';
strcat(StringDATA,"KAT:");
strcat(StringDATA,a);
strcat(StringDATA," > GUNEY KORIDORU");
}
myTextBox->setText(str.c_str());
if(receiver.IsKeyDown(irr::KEY_KEY_W)){
XPos_Positive = (1 * MetreBUYUTME);
}
if(receiver.IsKeyDown(irr::KEY_KEY_S)){
XPos_Negative = (1 * MetreBUYUTME);
}
if(receiver.IsKeyDown(irr::KEY_KEY_A)){
ZPos_Positive = (1 * MetreBUYUTME);
}
if(receiver.IsKeyDown(irr::KEY_KEY_D)){
ZPos_Negative = (1 * MetreBUYUTME);
}
if(receiver.IsKeyDown(irr::KEY_KEY_K)){
BPlaniPanik = 1;
}
if(receiver.IsKeyDown(irr::KEY_KEY_L)){
BPlaniPanik = 0;
}
}
device->drop();
return 0;
}