本文整理汇总了C++中mygui::UString::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ UString::push_back方法的具体用法?C++ UString::push_back怎么用?C++ UString::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mygui::UString
的用法示例。
在下文中一共展示了UString::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyPressed
bool WinState::keyPressed(const OIS::KeyEvent &e)
{
MyGUI::UString txt = user_name_txt->getCaption();
if ((int)e.key==14 && txt.size()>0)
{
txt.resize(txt.size()-1);
}
else
{
if (((int)e.text >=65 && (int)e.text<=90) || ((int)e.text>=97 && (int)e.text<=122))
{
if (txt.size()<CONSTANTS_MAX_USERNAME_SIZE) txt.push_back(e.text);
}
}
user_name_txt->setCaption(txt);
if ((e.key == OIS::KC_ESCAPE) || (e.key == OIS::KC_RETURN) || (e.key == OIS::KC_R))
{
cout << "NEW RECORD TO SAVE" << endl;
save_record();
popState();
}
return true;
}
示例2: keyPressed
bool PlayState::keyPressed(const OIS::KeyEvent &e)
{
if (!user_name_txt->getVisible())
{
// if (paused) pause(); // ESTO NO ES NECESARIO. AL HACER UN PUSHSTATE EL GAMEMANAGER LLAMARÁ A PAUSE() AUTOMATICAMENTE
// else
if (!paused)
{
if (e.key == OIS::KC_P) {
paused = true;
pushState(PauseState::getSingletonPtr());
}
else if (e.key == OIS::KC_G) {
paused = true;
game_over();
}
else if (e.key == OIS::KC_W) {
win();
}
else if (e.key == OIS::KC_UP)
{
_pacmanDir = UP_DIR;
}
else if (e.key == OIS::KC_DOWN) {
_pacmanDir = DOWN_DIR;
}
else if (e.key == OIS::KC_LEFT) {
_pacmanDir = LEFT_DIR;
}
else if (e.key == OIS::KC_RIGHT) {
_pacmanDir = RIGHT_DIR;
}
// else if (e.key == OIS::KC_ESCAPE) {
// popState();
// pushState(IntroState::getSingletonPtr());
// }
}
}
else
{
sounds::getInstance()->play_effect("eat_fruit");
MyGUI::UString txt = user_name_txt->getCaption();
if ((int)e.key==14 && txt.size()>0) txt.resize(txt.size()-1);
else
{
if (((int)e.text >=65 && (int)e.text<=90) || ((int)e.text>=97 && (int)e.text<=122))
{
if (txt.size()<3) txt.push_back(e.text);
}
}
user_name_txt->setCaption(txt);
if (e.key==OIS::KC_RETURN)
{
cout << "NEW RECORD TO SAVE" << endl;
records::getInstance()->add_record(txt,get_score());
records::getInstance()->saveFile(NULL);
sounds::getInstance()->play_effect("eat_ghost");
user_name_txt->setVisible(false);
popState();
stopWorld = false;
}
}
return true;
}