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);
}
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();
}
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                                       ) );
}
Exemplo n.º 4
0
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();
}
Exemplo n.º 5
0
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));  
}
Exemplo n.º 6
0
//-------------------------------------------------------------------------------------
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));
}
Exemplo n.º 7
0
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));
}
Exemplo n.º 8
0
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));
}
Exemplo n.º 9
0
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));
}
Exemplo n.º 10
0
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;
}
Exemplo n.º 11
0
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));
}
Exemplo n.º 12
0
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 );

}
Exemplo n.º 13
0
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();
}
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);
}
Exemplo n.º 15
0
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);
}
Exemplo n.º 16
0
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));

}
Exemplo n.º 17
0
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);
}
Exemplo n.º 18
0
void GUIManager::LoadMainMenu()
{
	CEGUI::ImagesetManager::getSingletonPtr()->createFromImageFile("mainMenuBG","background.tga");
	
	//add background
	CEGUI::Window *mainMenu = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "mainMenu");
	sheet->addChildWindow(mainMenu);
	mainMenu->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
	mainMenu->setPosition(CEGUI::UVector2(CEGUI::UDim(0, 0), CEGUI::UDim(0, 0)));
	mainMenu->setProperty("Image", "set:mainMenuBG image:full_image" );
	mainMenu->setAlpha(1.0);

	CEGUI::PushButton* login = (CEGUI::PushButton*)CEGUI::WindowManager::getSingleton().createWindow("WindowsLook/Button");
	mainMenu->addChildWindow(login);
	login->setArea(CEGUI::URect(CEGUI::UDim(0.2f,0), CEGUI::UDim(0.65f,0), 
							  CEGUI::UDim(0.3f,0), CEGUI::UDim(0.7f,0)));
	login->subscribeEvent(CEGUI::PushButton::EventActivated, CEGUI::Event::Subscriber(&GUIManager::HandleGameLoginClicked, this));
}
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());
	}
}
Exemplo n.º 20
0
void SubscriberAHEvent(CEGUI::Window* pageWnd)
{
	pageWnd->subscribeEvent(EVENT_OPEN,CEGUI::Event::Subscriber(OnOpenedUpdate));//绑定打开界面刷新数据事件

	pageWnd->subscribeEvent("UpdatePickUpUI",CEGUI::Event::Subscriber(UpdatePickUPUIDate));//更新提取界面UI

	CEGUI::PushButton* btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/BtnBuyWeimian"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnBuyWeimianBtnClicked));//点击按钮购买位面

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/BtnSalWeimian"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnSaleWeimianBtnClicked));//点击按钮出售位面

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Pickup/BtnGold"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnPickUpGold));//提取金币

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Pickup/BtnWeimian"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnPickUpWeimian));//提取位面

	CEGUI::MultiColumnList* mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/SaleMCL"));
	mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnSaleMCLSelChanged));//位面可购买条目选中事件
	mcl->subscribeEvent("UpdateCanBuyMCL",CEGUI::Event::Subscriber(UpdateCanBuyMCLDate));//更新可购买出售列表
	mcl->subscribeEvent(CEGUI::Window::EventMouseDoubleClick,CEGUI::Event::Subscriber(OnBuyWeimianBtnClicked));//双击可购买Item,事件响应

	mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/BuySale/BuyMCL"));
	mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnBuyMCLSelChanged));//位面可出售条目选中事件
	mcl->subscribeEvent("UpdateBuyMCL",CEGUI::Event::Subscriber(UpdateCanSaleMCLDate));//更新可出售列表
	mcl->subscribeEvent(CEGUI::Window::EventMouseDoubleClick,CEGUI::Event::Subscriber(OnSaleWeimianBtnClicked));//双击可出售Item,事件响应

	mcl = WMCL(pageWnd->getChildRecursive("Auction/Tab/Query/MCL"));
	mcl->subscribeEvent(CEGUI::MultiColumnList::EventSelectionChanged,CEGUI::Event::Subscriber(OnPerMCLSelChanged));//个人挂单条目选中事件
	mcl->subscribeEvent("UpdatePerMCL",CEGUI::Event::Subscriber(UpdatePerMCLDate));//更新个人挂单列表

	CEGUI::Window* wnd = pageWnd->getChildRecursive("Auction/SaleWnd");
	wnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(OnSaleUIClosed));//出售界面关闭

	btn = WPushButton(wnd->getChildRecursive("Auction/SaleWnd/Submit"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnSaleSubmit));//提交出售请求

	wnd = pageWnd->getChildRecursive("Auction/BuyWnd");
	wnd->subscribeEvent(CEGUI::FrameWindow::EventCloseClicked,CEGUI::Event::Subscriber(OnBuyUIClosed));//购买界面关闭

	btn = WPushButton(wnd->getChildRecursive("Auction/Buy/Submit"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnBuySubmit));//提交购买请求

	CEGUI::Editbox* edb = WEditBox(pageWnd->getChildRecursive("Auction/Buy/buyNum"));//
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateBuyUIDate));//购买界面UI更新

	edb = WEditBox(pageWnd->getChildRecursive("Auction/SaleWnd/saleNum"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateSaleUIDate));//出售界面UI更新

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/Submit"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnAgentSaleSubmit));//委托出售挂单提交

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/Submit"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnAgentBuySubmit));//委托求购挂单提交

	edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditNum"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentSaleUIDate));//委托出售挂单UI更新
	edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/sale/EditPrice"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentSaleUIDate));//委托出售挂单UI更新


	edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditNum"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentBuyUIDate));//委托求购UI更新
	edb = WEditBox(pageWnd->getChildRecursive("Auction/Tab/Agent/Buy/EditPrice"));
	edb->subscribeEvent(CEGUI::Window::EventTextChanged,CEGUI::Event::Subscriber(UpdateAgentBuyUIDate));//委托求购UI更新

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Query/Cancel"));//个人委托撤销挂单
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnCancelAgentOrder));

	//
	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/Query/Refresh"));//发送请求更新个人挂单列表
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshPerMCL));

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshSale"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshSaleMCL));//发送请求更新出售委托挂单列表

	btn = WPushButton(pageWnd->getChildRecursive("Auction/Tab/BuySale/RefreshBuy"));
	btn->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(OnRefreshBuyMCL));//发送请求更新求购委托挂单列表


}