本文整理汇总了C++中cegui::PushButton::subscribeEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ PushButton::subscribeEvent方法的具体用法?C++ PushButton::subscribeEvent怎么用?C++ PushButton::subscribeEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cegui::PushButton
的用法示例。
在下文中一共展示了PushButton::subscribeEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: OnPageLoad
void CREvent::OnPageLoad(GamePage *pPage)
{
pPage->LoadPageWindow();
CEGUI::Window *pPageWin = pPage->GetPageWindow();
CEGUI::PushButton* pCreateBtn = static_cast<CEGUI::PushButton*>(pPageWin->getChild("CreateRole"));
pCreateBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&CREvent::OnCreateRoleBtn, this));
CEGUI::PushButton* pGoBackBtn = static_cast<CEGUI::PushButton*>(pPageWin->getChildRecursive("BackToSelRol"));
pGoBackBtn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&CREvent::GoBackBtn,this));
SetCreateRoleInitProperty(pPageWin);
m_bRoleLeftRotate = false; //向左旋转
m_bRoleRightRotate = false; //向右旋转
if (m_SelectSence == NULL)
{
m_SelectSence = new GameScene();
m_SelectSence->CreateSence("model/interface/selectchar/map",
"model/interface/selectchar/map/camera_end",
"model/interface/selectchar/map/envcreature",
"model/interface/selectchar/map/enveffect");
}
CRFile* prfile = rfOpen("data/CreateRolePos.ini");
if (prfile)
{
stringstream stream;
prfile->ReadToStream(stream);
rfClose(prfile);
stream >> s_RolePos[0] >> s_RolePos[1] >> s_RolePos[2] >> s_RolePos[3];
}
if(m_pPlayer == NULL)
m_pPlayer = new CPlayer;
m_pPlayer->SetGraphicsID(CREvent::GetSelectSex()+1);
LoadFaceHairIni();
m_pPlayer->SetDisplayModel();
m_pPlayer->SetDisplayModelGroup();
}
示例3: GetWindow
void
CFileSystemDialogImp::OnPostLayoutLoad( void )
{GUCE_TRACE;
GUCEF::GUI::CFileSystemDialog::OnPostLayoutLoad();
// Try and link the icon imageset
CEGUI::ImagesetManager* imgSetManager = CEGUI::ImagesetManager::getSingletonPtr();
if ( imgSetManager->isImagesetPresent( "Icons" ) )
{
m_iconsImageSet = imgSetManager->getImageset( "Icons" );
}
// Hook up the event handlers
CEGUI::FrameWindow* window = static_cast< CEGUI::FrameWindow* >( GetWindow()->GetImplementationPtr() );
window->subscribeEvent( CEGUI::FrameWindow::EventCloseClicked ,
CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnCancelButtonClick ,
this ) );
CEGUI::MultiColumnList* fsViewWidget = static_cast< CEGUI::MultiColumnList* >( GetFileSystemGridView()->GetImplementationPtr() );
fsViewWidget->subscribeEvent( CEGUI::MultiColumnList::EventSelectionChanged ,
CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnItemSelected ,
this ) );
fsViewWidget->subscribeEvent( CEGUI::MultiColumnList::EventMouseDoubleClick ,
CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnItemDblClicked ,
this ) );
CEGUI::PushButton* okButton = static_cast< CEGUI::PushButton* >( GetOkButton()->GetImplementationPtr() );
okButton->subscribeEvent( CEGUI::PushButton::EventClicked ,
CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnOkButtonClick ,
this ) );
CEGUI::PushButton* cancelButton = static_cast< CEGUI::PushButton* >( GetCancelButton()->GetImplementationPtr() );
cancelButton->subscribeEvent( CEGUI::PushButton::EventClicked ,
CEGUI::Event::Subscriber( &CFileSystemDialogImp::OnCancelButtonClick ,
this ) );
}
示例4: initConnect
void t_chessGui::initConnect()
{
CEGUI::FrameWindow *connect = static_cast<CEGUI::FrameWindow *>(wmgr->loadWindowLayout("connect.layout"));
myRoot->addChildWindow(connect);
connect->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(boost::bind(closeConnect,connect,_1)));
CEGUI::MenuItem *connectItem = static_cast<CEGUI::MenuItem *>(wmgr->getWindow("Root/FrameWindow/Menubar/File/Open"));
connectItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openConnect,connect,_1)));
CEGUI::PushButton *newConnectItem = static_cast<CEGUI::PushButton *>(wmgr->getWindow("Lols2"));
newConnectItem->subscribeEvent(CEGUI::MenuItem::EventClicked,CEGUI::Event::Subscriber(boost::bind(openConnect,connect,_1)));
CEGUI::PushButton *cancelConnect = static_cast<CEGUI::PushButton *>(wmgr->getWindow("1Lols6"));
cancelConnect->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(boost::bind(closeConnect,connect,_1)));
CEGUI::Editbox *name = static_cast<CEGUI::Editbox *>(wmgr->getWindow("1Lols2"));
CEGUI::Editbox *ip = static_cast<CEGUI::Editbox *>(wmgr->getWindow("1Lols7"));
CEGUI::PushButton *startConnection = static_cast<CEGUI::PushButton *>(wmgr->getWindow("1Lols4"));
startConnection->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(boost::bind(connectToServer,name,ip,boost::ref(sharedData),_1)));
connect->hide();
}
示例5: SwitchToMainMenu
bool MenuApp::SwitchToMainMenu(const CEGUI::EventArgs& e) {
menu = Wmgr->getWindow("Menu/Background");
CEGUI::System::getSingleton().setGUISheet(menu);
CEGUI::PushButton* singlePlayerButton = (CEGUI::PushButton*)Wmgr->getWindow("Menu/SinglePlayer");
CEGUI::PushButton* multiPlayerButton = (CEGUI::PushButton*)Wmgr->getWindow("Menu/MultiPlayer");
CEGUI::PushButton* quitButton = (CEGUI::PushButton*)Wmgr->getWindow("Menu/QuitGame");
singlePlayerButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuApp::StartSinglePlayer,this));
multiPlayerButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuApp::SwitchToMultiMenu, this));
quitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuApp::quit,this));
}
示例6: SwitchToMultiMenu
//-------------------------------------------------------------------------------------
bool MenuApp::SwitchToMultiMenu(const CEGUI::EventArgs& e) {
menu = Wmgr->getWindow("Menu/MultiBackground");
CEGUI::System::getSingleton().setGUISheet(menu);
CEGUI::PushButton* hostButton = (CEGUI::PushButton*)Wmgr->getWindow("Menu/Host");
CEGUI::PushButton* clientButton = (CEGUI::PushButton*)Wmgr->getWindow("Menu/Client");
CEGUI::PushButton* returnButton = (CEGUI::PushButton*)Wmgr->getWindow("Menu/Return");
hostButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuApp::StartHost,this));
clientButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuApp::StartClient,this));
returnButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuApp::SwitchToMainMenu,this));
}
示例7: buildGUI
void MenuState::buildGUI()
{
OgreFramework::getSingletonPtr()->m_pGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseArrow");
const OIS::MouseState state = OgreFramework::getSingletonPtr()->m_pMouse->getMouseState();
CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition();
CEGUI::System::getSingleton().injectMouseMove(state.X.abs-mousePos.d_x,state.Y.abs-mousePos.d_y);
CEGUI::Window* pMainWnd = CEGUI::WindowManager::getSingleton().getWindow("AOF_GUI");
OgreFramework::getSingletonPtr()->m_pGUISystem->setGUISheet(pMainWnd);
CEGUI::PushButton* button = (CEGUI::PushButton*)pMainWnd->getChild("ExitButton");
button->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::onExitButton, this));
button = (CEGUI::PushButton*)pMainWnd->getChild("EnterButton");
button->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::onEnterButton, this));
}
示例8:
MainMenuDlg::MainMenuDlg(CEGUI::System *pSystem, CEGUI::Window *pSheet, Simulation *pSimulation)
{
m_pSystem = pSystem;
m_pWindow = pSheet;
m_pSimulation = pSimulation;
// hook up the event handlers to the window elements
CEGUI::PushButton* pQuitButton = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("cmdQuit");
pQuitButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuDlg::Quit_OnClick, this));
CEGUI::PushButton* pOptionsButton = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("cmdOptions");
pOptionsButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuDlg::Options_OnClick, this));
CEGUI::PushButton* pLaunchButton = (CEGUI::PushButton *)CEGUI::WindowManager::getSingleton().getWindow("cmdInstantAction");
pLaunchButton->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MainMenuDlg::Launch_OnClick, this));
}
示例9: setClose
void GUIManager::setClose ( Screen *s )
{
CEGUI::PushButton *close = static_cast<CEGUI::PushButton *>(
CEGUI::WindowManager::getSingleton().getWindow("Sheet/Close"));
auto f = [=] (CEGUI::EventArgs const &) -> bool { s->close(); return true; };
close->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(f));
}
示例10: InitGameExit
CEGUI::Window* InitGameExit()
{
CEGUI::Window* wnd = LoadUI("GameExit");
wnd->setVisible(false);
CEGUI::PushButton* btn = WPushButton(wnd->getChild("GameExit/CharSel"));
btn->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(OnReturnCharSel));
btn = WPushButton(wnd->getChild("GameExit/ServerSel"));
btn->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(OnReturnServerSel));
btn = WPushButton(wnd->getChild("GameExit/Login"));
btn->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(OnReturnLogin));
btn = WPushButton(wnd->getChild("GameExit/Exit"));
btn->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(OnReturnExit));
return wnd;
}
示例11: setHandlers
void GUIManager::setHandlers ()
{
CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
CEGUI::FrameWindow *dsFrame = static_cast<CEGUI::FrameWindow *>(
wm.getWindow("Sheet/DatasetFrame"));
dsFrame->hide();
// Handle behavior of options-button
CEGUI::PushButton *button = static_cast<CEGUI::PushButton *>(
wm.getWindow("Sheet/Options"));
button->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&GUIManager::handleOptionsVisibility, this));
button = dsFrame->getCloseButton();
button->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&GUIManager::handleOptionsVisibility, this));
// Connect activate buttons on tabs
auto connectFrames = [=](CEGUI::Window *tab) {
CEGUI::PushButton *button =
static_cast<CEGUI::PushButton *>(tab->getChild(3));
button->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&GUIManager::handleDSActivation, this));
button = static_cast<CEGUI::PushButton *>(tab->getChild(4));
button->subscribeEvent(CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&GUIManager::handleDSDeactivation, this));
CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
sb->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged,
CEGUI::Event::Subscriber(&GUIManager::handleScrollbarChanged, this));
CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
lb->subscribeEvent(CEGUI::Listbox::EventSelectionChanged,
CEGUI::Event::Subscriber(&GUIManager::handleDSSelection, this));
};
CEGUI::Window *tab = wm.getWindow("Sheet/DatasetFrame/TabControl/HTab");
connectFrames(tab);
tab = wm.getWindow("Sheet/DatasetFrame/TabControl/PTab");
connectFrames(tab);
tab = wm.getWindow("Sheet/DatasetFrame/TabControl/CTab");
connectFrames(tab);
CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(
wm.getWindow("Sheet/DimensionSlider"));
sb->subscribeEvent(CEGUI::Scrollbar::EventScrollPositionChanged,
CEGUI::Event::Subscriber(&GUIManager::handleBigScrollbarChanged, this));
}
示例12: showHighScoreEntryDialog
void GameState::showHighScoreEntryDialog()
{
CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
_highScoreEntryDialog = winMgr.loadWindowLayout( "highScoreEntry.layout" );
CEGUI::Window* text = static_cast<CEGUI::Window*>(winMgr.getWindow("StaticText"));
CEGUI::PushButton* btnOk = static_cast<CEGUI::PushButton*>(winMgr.getWindow("btnOk"));
CEGUI::PushButton* btnCancel = static_cast<CEGUI::PushButton*>(winMgr.getWindow("btnCancel"));
CEGUI::Editbox* editbox = static_cast<CEGUI::Editbox*>(winMgr.getWindow("Editbox"));
text->setText(std::string("New HighScore!\n")+boost::lexical_cast<std::string,int>((int)_playerScore));
btnOk->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameState::enterHighScore,this) );
btnCancel->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GameState::skipHighScore,this) );
editbox->setText("Unknown");
editbox->setMaxTextLength(7);
editbox->setValidationString("^\\w*$");
CEGUI::System::getSingleton().setGUISheet( _highScoreEntryDialog );
}
示例13: enter
void MenuState::enter()
{
OgreFramework::getSingletonPtr()->m_pLog->logMessage("Entering MenuState...");
m_pSceneMgr = OgreFramework::getSingletonPtr()->m_pRoot->createSceneManager(ST_GENERIC, "MenuSceneMgr");
m_pSceneMgr->setAmbientLight(Ogre::ColourValue(0.7, 0.7, 0.7));
m_pCamera = m_pSceneMgr->createCamera("MenuCam");
m_pCamera->setPosition(Vector3(0, 25, -50));
m_pCamera->lookAt(Vector3(0, 0, 0));
m_pCamera->setNearClipDistance(1);
m_pCamera->setAspectRatio(Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualWidth()) /
Real(OgreFramework::getSingletonPtr()->m_pViewport->getActualHeight()));
OgreFramework::getSingletonPtr()->m_pViewport->setCamera(m_pCamera);
OgreFramework::getSingletonPtr()->m_pKeyboard->setEventCallback(this);
OgreFramework::getSingletonPtr()->m_pMouse->setEventCallback(this);
OgreFramework::getSingletonPtr()->m_pGUIRenderer->setTargetSceneManager(m_pSceneMgr);
OgreFramework::getSingletonPtr()->m_pGUISystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
CEGUI::MouseCursor::getSingleton().setImage("TaharezLook", "MouseArrow");
const OIS::MouseState state = OgreFramework::getSingletonPtr()->m_pMouse->getMouseState();
CEGUI::Point mousePos = CEGUI::MouseCursor::getSingleton().getPosition();
CEGUI::System::getSingleton().injectMouseMove(state.X.abs - mousePos.d_x, state.Y.abs - mousePos.d_y);
CEGUI::Window* pMainWnd = CEGUI::WindowManager::getSingleton().getWindow("AOF_GUI");
OgreFramework::getSingletonPtr()->m_pGUISystem->setGUISheet(pMainWnd);
CEGUI::PushButton* button = (CEGUI::PushButton*)pMainWnd->getChild("ExitButton");
button->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::onExitButton, this));
button = (CEGUI::PushButton*)pMainWnd->getChild("EnterButton");
button->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::onEnterButton, this));
m_bQuit = false;
createScene();
}
示例14: buildGUI
void CharacterSelectState::buildGUI()
{
CEGUI::WindowManager &windMgr = CEGUI::WindowManager::getSingleton();
m_pMainWnd = windMgr.getWindow("CHAR_SEL_GUI");
m_pCharWnd = windMgr.getWindow("CharSelectWnd");
CEGUI::PushButton* createChar = (CEGUI::PushButton*)m_pCharWnd->getChild("CreateChar");
createChar->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharacterSelectState::onCharacterCreateButton, this));
CEGUI::PushButton* enterWorld = (CEGUI::PushButton*)m_pMainWnd->getChild("EnterWorld");
enterWorld->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&CharacterSelectState::onEnterWorldButton, this));
ParseDatabase();
stringstream ss;
for( pugi::xml_node node = root.child("character"); ; ) {
if (node) {
for (pugi::xml_attribute_iterator ait = node.attributes_begin(); ; ) {
ss << ait->value();
++ait;
if(ait != node.attributes_end())
ss << " ";
else
break;
}
node = node.next_sibling("character");
if (node)
ss << ";";
else
break;
} else {
ss << "EMPTY";
break;
}
}
CreateCharacterButtons(ss.str());
OgreFramework::getSingletonPtr()->m_pGUISystem->setGUISheet(m_pMainWnd);
}
示例15: 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);
}