本文整理汇总了C++中cegui::PushButton::setText方法的典型用法代码示例。如果您正苦于以下问题:C++ PushButton::setText方法的具体用法?C++ PushButton::setText怎么用?C++ PushButton::setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::PushButton
的用法示例。
在下文中一共展示了PushButton::setText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initUI
void MainMenuScreen::initUI() {
// Init the UI
m_gui.init("GUI");
m_gui.loadScheme("TaharezLook.scheme");
m_gui.setFont("DejaVuSans-10");
CEGUI::PushButton* playGameButton = static_cast<CEGUI::PushButton*>(m_gui.createWidget("TaharezLook/Button", glm::vec4(0.45f, 0.5f, 0.1f, 0.05f), glm::vec4(0.0f), "NewGameButton"));
playGameButton->setText("New Game");
// Set up event to be called when we click
playGameButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuScreen::onNewGameClicked, this));
CEGUI::PushButton* editorButton = static_cast<CEGUI::PushButton*>(m_gui.createWidget("TaharezLook/Button", glm::vec4(0.45f, 0.56f, 0.1f, 0.05f), glm::vec4(0.0f), "EditorButton"));
editorButton->setText("Level Editor");
// Set up event to be called when we click
editorButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuScreen::onEditorClicked, this));
CEGUI::PushButton* exitButton = static_cast<CEGUI::PushButton*>(m_gui.createWidget("TaharezLook/Button", glm::vec4(0.45f, 0.62f, 0.1f, 0.05f), glm::vec4(0.0f), "ExitButton"));
exitButton->setText("Exit Game");
// Set the event to be called when we click
exitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuScreen::onExitClicked, this));
m_gui.setMouseCursor("TaharezLook/MouseArrow");
m_gui.showMouseCursor();
SDL_ShowCursor(0);
}
示例2: initUI
void LevelOneScreen::initUI(){
_gui.init("GUI");
_gui.loadScheme("TaharezLook.scheme");
_gui.loadScheme("AlfiskoSkin.scheme");
_gui.setFont("DejaVuSans-10");
CEGUI::PushButton* exitButton = static_cast<CEGUI::PushButton*>(_gui.createWidget("AlfiskoSkin/Button", glm::vec4(0.0f, 0.0f, 0.06, 0.03f), glm::vec4(0.0f), "ExitButton"));
exitButton->setText("Exit Game");
exitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&LevelOneScreen::onExitCliked, this));
_gui.setMouseCursor("TaharezLook/MouseArrow");
_gui.showMouseCursor();
SDL_ShowCursor(0);
}
示例3: OnPageLoad
void LoginEvent::OnPageLoad(GamePage *pPage)
{
pPage->LoadPageWindow();
CEGUI::Window *pLoginWindow = pPage->GetPageWindow();
/////////////////////////////////////////////////
// zhaohang 2010/6/4
// 添加选服的修改
//首次打开显示选择登陆服务器界面
FireUIEvent("SelectLS",EVENT_OPEN);
//设置密码编辑框掩码
CEGUI::Editbox *pPwdEdit = static_cast<CEGUI::Editbox*>(pLoginWindow->getChild("LoginPage/PassWord"));
pPwdEdit->setTextMasked(true);
pPwdEdit->subscribeEvent(CEGUI::Editbox::EventTextAccepted ,CEGUI::Event::Subscriber(&LoginEvent::HandleLogin, this));
//设置相应事件处理函数
CEGUI::PushButton *pEnterBtn = static_cast<CEGUI::PushButton*>(pLoginWindow->getChild("LoginPage/Enter"));
pEnterBtn->setText(ToCEGUIString(AppFrame::GetText("Login_1")));
//pEnterBtn->setText(ToCEGUIString("[ROLL Speed:1 Dir:Left Text:nihao]"));
pEnterBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&LoginEvent::HandleLogin, this));
CEGUI::PushButton *pExitBtn = static_cast<CEGUI::PushButton*>(pLoginWindow->getChild("LoginPage/Exit"));
pExitBtn->setText(ToCEGUIString(AppFrame::GetText("Login_2")));
pExitBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&LoginEvent::HandleExitBtn, this));
CEGUI::PushButton *pRegistBtn = static_cast<CEGUI::PushButton*>(pLoginWindow->getChild("LoginPage/Register"));
pRegistBtn->setText(ToCEGUIString(AppFrame::GetText("Login_3")));
CEGUI::PushButton *pForgetPwdBtn = static_cast<CEGUI::PushButton*>(pLoginWindow->getChild("LoginPage/ForgetPwd"));
pForgetPwdBtn->setText(ToCEGUIString(AppFrame::GetText("Login_4")));
CEGUI::PushButton* serverInfo = static_cast<CEGUI::PushButton*>(pLoginWindow->getChild("Login/ServerInfo"));
serverInfo->setText(ToCEGUIString(AppFrame::GetText("Login_5")));
serverInfo->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(HandleEnterSelectLS));
}
示例4: initUI
void GameplayScreen::initUI() {
// Init the UI
m_gui.init("GUI");
m_gui.loadScheme("TaharezLook.scheme");
m_gui.setFont("DejaVuSans-10");
CEGUI::PushButton* testButton = static_cast<CEGUI::PushButton*>(m_gui.createWidget("TaharezLook/Button", glm::vec4(0.5f, 0.5f, 0.1f, 0.05f), glm::vec4(0.0f), "TestButton"));
testButton->setText("Exit Game!");
// Set the event to be called when we click
testButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameplayScreen::onExitClicked, this));
CEGUI::Combobox* TestCombobox = static_cast<CEGUI::Combobox*>(m_gui.createWidget("TaharezLook/Combobox", glm::vec4(0.2f, 0.2f, 0.1f, 0.05f), glm::vec4(0.0f), "TestCombobox"));
m_gui.setMouseCursor("TaharezLook/MouseArrow");
m_gui.showMouseCursor();
SDL_ShowCursor(0);
}
示例5: handleMineButtonClicked
/************************************************************************
Handle click on a mine button
************************************************************************/
bool MinesweeperSample::handleMineButtonClicked(const CEGUI::EventArgs& event)
{
const CEGUI::WindowEventArgs* evt = static_cast<const CEGUI::WindowEventArgs*>(&event);
CEGUI::PushButton* button = static_cast<CEGUI::PushButton*>(evt->window);
Location* buttonLoc = static_cast<Location*>(button->getUserData());
if (button->getID() > 0)
{
// dont touch flagged buttons
return true;
}
if (boardDiscover(*buttonLoc))
{
// We did not find a mine
button->setText(CEGUI::PropertyHelper<CEGUI::uint>::toString(d_board[buttonLoc->d_row][buttonLoc->d_col]));
if (isGameWin())
gameEnd(true);
}
else
{
for(size_t i = 0 ; i < MinesweeperSize ; ++i)
{
for (size_t j = 0 ; j < MinesweeperSize ; ++j)
{
if (! d_buttons[i][j]->isDisabled())
{
if (d_board[i][j] > 8)
{
d_buttons[i][j]->setText("B");
d_buttons[i][j]->setProperty("DisabledTextColour", "FFFF1010");
}
else
{
d_buttons[i][j]->setText(CEGUI::PropertyHelper<CEGUI::uint>::toString(d_board[i][j]));
}
}
d_buttons[i][j]->setEnabled(false);
}
}
gameEnd(false);
}
return true;
}
示例6: CreateCharacterButtons
void CharacterSelectState::CreateCharacterButtons(std::string data)
{
if (data.compare("EMPTY") != 0 ) {
std::vector<std::string> characters = StringHelper::split(data, ';');
std::cout << "character data: " << data << std::endl;
charactersData = data;
for(int i = 0; i < characters.size(); i++) {
std::vector<std::string> charData = StringHelper::split(characters[i], ' ');
CEGUI::WindowManager &windMgr = CEGUI::WindowManager::getSingleton();
CEGUI::PushButton *tempBtn = (CEGUI::PushButton*)windMgr.createWindow("TaharezLook/Button", charData[0]);
tempBtn->setHorizontalAlignment(CEGUI::HA_CENTRE);
tempBtn->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0f, 0.0f), CEGUI::UDim( 0.015f+(i*0.11), 0.0f ) ) );
tempBtn->setSize( CEGUI::UVector2( CEGUI::UDim( 0.9f, 0.0f ), CEGUI::UDim( 0.10f, 0.0f ) ) );
std::stringstream ss;
ss << charData[0] << "\n" << "Level " << charData[1];
tempBtn->setText(ss.str());
tempBtn->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharacterSelectState::onCharacterSelButton, this));
m_pCharWnd->addChildWindow(tempBtn);
}
printf("%i Character buttons created\n", characters.size());
}
}
示例7: onEntry
void GameplayScreen::onEntry() {
b2Vec2 gravity(0.0f, -25.0);
m_world = std::make_unique<b2World>(gravity);
m_debugRenderer.init();
// Make the ground
b2BodyDef groundBodyDef;
groundBodyDef.position.Set(0.0f, -20.0f);
b2Body* groundBody = m_world->CreateBody(&groundBodyDef);
// Make the ground fixture
b2PolygonShape groundBox;
groundBox.SetAsBox(50.0f, 10.0f);
groundBody->CreateFixture(&groundBox, 0.0f);
// Load the texture
m_texture = Bengine::ResourceManager::getTexture("Assets/bricks_top.png");
// Make a bunch of boxes
std::mt19937 randGenerator;
std::uniform_real_distribution<float> xPos(-10.0, 10.0f);
std::uniform_real_distribution<float> yPos(-10.0, 25.0f);
std::uniform_real_distribution<float> size(0.5, 2.5f);
std::uniform_int_distribution<int> color(50, 255);
const int NUM_BOXES = 10;
for (int i = 0; i < NUM_BOXES; i++) {
Bengine::ColorRGBA8 randColor;
randColor.r = color(randGenerator);
randColor.g = color(randGenerator);
randColor.b = color(randGenerator);
randColor.a = 255;
Box newBox;
newBox.init(m_world.get(), glm::vec2(xPos(randGenerator), yPos(randGenerator)), glm::vec2(size(randGenerator), size(randGenerator)), m_texture, randColor, false);
m_boxes.push_back(newBox);
}
// Initialize spritebatch
m_spriteBatch.init();
// Shader init
// Compile our texture
m_textureProgram.compileShaders("Shaders/textureShading.vert", "Shaders/textureShading.frag");
m_textureProgram.addAttribute("vertexPosition");
m_textureProgram.addAttribute("vertexColor");
m_textureProgram.addAttribute("vertexUV");
m_textureProgram.linkShaders();
// Compile our light shader
m_lightProgram.compileShaders("Shaders/lightShading.vert", "Shaders/lightShading.frag");
m_lightProgram.addAttribute("vertexPosition");
m_lightProgram.addAttribute("vertexColor");
m_lightProgram.addAttribute("vertexUV");
m_lightProgram.linkShaders();
// Init camera
m_camera.init(m_window->getScreenWidth(), m_window->getScreenHeight());
m_camera.setScale(32.0f);
// Init player
m_player.init(m_world.get(), glm::vec2(0.0f, 30.0f), glm::vec2(2.0f), glm::vec2(1.0f, 1.8f), Bengine::ColorRGBA8(255, 255, 255, 255));
// Init the UI
m_gui.init("GUI");
m_gui.loadScheme("TaharezLook.scheme");
m_gui.setFont("DejaVuSans-10");
CEGUI::PushButton* testButton = static_cast<CEGUI::PushButton*>(m_gui.createWidget("TaharezLook/Button", glm::vec4(0.5f, 0.5f, 0.1f, 0.05f), glm::vec4(0.0f), "TestButton"));
testButton->setText("Hello World!");
}