本文整理汇总了C++中cegui::Window::getText方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::getText方法的具体用法?C++ Window::getText怎么用?C++ Window::getText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::Window
的用法示例。
在下文中一共展示了Window::getText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPlayerShopBuyNumChange
bool OnPlayerShopBuyNumChange(const CEGUI::EventArgs& e)
{
CEGUI::Window* wnd = WEArgs(e).window;
if(!wnd) return false;
CEGUI::String buyNum = wnd->getText();
char str[32] = "";
CEGUI::Window* goodsWnd = wnd->getParent();
if (goodsWnd)
{
CGoods* goods = static_cast<CGoods*>(goodsWnd->getUserData());
if (!goods) return false;
PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods);
if (pGoodsItem!=NULL)
{
ulong num = atoi(buyNum.c_str());
if (num>=pGoodsItem->groupNum)
{
sprintf(str,"%d",pGoodsItem->groupNum);
}
else if (num<=0)
{
sprintf(str,"%d",0);
}
sprintf(str,"%d",num);
wnd->setText(ToCEGUIString(str));
pGoodsItem->readyTradeNum = num;
}
}
return true;
}
示例2: createScorePopup
void HUDDemo::createScorePopup(const CEGUI::Vector2<float>& mousePos, int points)
{
CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* popupWindow = winMgr.createWindow("HUDDemo/PopupLabel");
d_rootIngame->addChild(popupWindow);
popupWindow->setPosition(CEGUI::UVector2(cegui_absdim(mousePos.d_x), cegui_absdim(mousePos.d_y)));
popupWindow->setText(CEGUI::PropertyHelper<int>::toString(points));
popupWindow->setRiseOnClickEnabled(false);
popupWindow->subscribeEvent(AnimationInstance::EventAnimationEnded, Event::Subscriber(&HUDDemo::handleScorePopupAnimationEnded, this));
popupWindow->setPixelAligned(false);
popupWindow->setFont("DejaVuSans-14");
popupWindow->setPosition(popupWindow->getPosition() + CEGUI::UVector2(cegui_reldim(0.03f), cegui_reldim(-0.02f)));
if(points < 0)
popupWindow->setProperty("NormalTextColour", "FF880000");
else
{
popupWindow->setText( "+" + popupWindow->getText());
popupWindow->setProperty("NormalTextColour", "FF006600");
}
CEGUI::EventArgs args;
popupWindow->fireEvent("StartAnimation", args);
}
示例3: SendPrompt
void PromptBox::SendPrompt(bool clickedOK)
{
if (mCallback.IsSet())
{
CEGUI::Window* editbox = mPromptBox->getChild(mPromptBox->getName() + "/Editbox");
string text = editbox->getText().c_str();
mCallback.Call(clickedOK, text, mTag);
}
delete this;
}
示例4: entryKeyDownHandler
bool OgreCmdWindow::entryKeyDownHandler(const CEGUI::EventArgs& e)
{
std::stringstream ss;
if(((const CEGUI::KeyEventArgs&)e).scancode == 28)
{
CEGUI::Window * wnd = ((const CEGUI::KeyEventArgs&)e).window;
((OgreCmdWindow*)wnd->getUserData())->readString(wnd->getText().c_str());
wnd->setText("");
}
return true;
}
示例5: OnPlayerShopSubBuyNum
bool OnPlayerShopSubBuyNum(const CEGUI::EventArgs& e)
{
CEGUI::Window* wnd = WEArgs(e).window;
if(!wnd) return false;
CEGUI::Window* goodsWnd = wnd->getParent();
if (goodsWnd)
{
CGoods* goods = static_cast<CGoods*>(goodsWnd->getUserData());
if (!goods) return false;
PlayerShop::tagGoodsItem* pGoodsItem = GetPlayerShop().FindtagGoods(goods);
if (pGoodsItem!=NULL)
{
char str[32];
// 取得输入框控件名
CEGUI::String name = wnd->getName();
name.assign(name, 0, name.find_last_of("/"));
name += "/BuyNum";
CEGUI::Window* buyNumWnd = GetWndMgr().getWindow(name);
int num = atoi(buyNumWnd->getText().c_str());
if (num<=0)
{
sprintf(str,"%d",0);
wnd->disable();
}
else
sprintf(str,"%d",num--);
buyNumWnd->setText(ToCEGUIString(str));
pGoodsItem->readyTradeNum = num;
}
}
return true;
}
示例6: OnClickButton
void Galaga::OnClickButton(CEGUI::Window* window)
{
Log("Got btn click galaga");
if(window->getName() == "Submit")
{
string msg = "";
CEGUI::Window* input = userInterface->rootWindow->getChild("Console")->getChild("Input");
CEGUI::Window* history = userInterface->rootWindow->getChild("Console")->getChild("History");
if(history && input)
{
msg = input->getText();
history->appendText(msg);
input->setText("");
}
if(msg == "host" && !client)
{
Log("Hosting.");
server = network->AddUser<ChatServer>();
server->Host(22222);
// ConnectEvent(SENDER(server, Host), RECEIVER(this, OnHost));
ConnectEvent(SENDER(server, ReceiveMessage), RECEIVER(this, OnReceiveMessage));
}
else if(msg == "connect" && !server)
{
Log("Connecting.");
client = network->AddUser<ChatClient>();
client->Connect("127.0.0.1", 22222);
// ConnectEvent(SENDER(client, Connect), RECEIVER(this, OnHost));
ConnectEvent(SENDER(client, ReceiveMessage), RECEIVER(this, OnReceiveMessage));
}
else if(msg == "disconnect")
{
if(client)
{
// Client::Destroy calls Disconnect() for us, if a connection is currently established.
client->SendMessage("[RemoveClient client]");
// client->Destroy();
}
else if(server)
{
// Close server?
server->SendMessage("[RemoveAllClients]");
// server->Destroy();
}
}
else if(msg == "destroy")
{
if(client)
{
client->Destroy();
}
else if(server)
{
// Close server?
server->Destroy();
}
}
else if(msg != "")
{
if(client)
{
client->SendMessage(msg);
}
else if(server)
{
server->SendMessage(msg);
}
}
}
}
示例7: onConsoleEditboxTextAccepted
bool DeveloperConsole::onConsoleEditboxTextAccepted(const CEGUI::EventArgs& args) {
CEGUI::Window* editbox = mConsoleWindow->getChild("Editbox");
CEGUI::String text = editbox->getText();
onConsoleTextSubmitted(text);
editbox->setText("");
}