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                                       ) );
}
Beispiel #3
0
/***********************************************************
handle event when list is selected
***********************************************************/
bool ChatBox::HandleLbSelected (const CEGUI::EventArgs& e)
{
	const CEGUI::ListboxTextItem * it = static_cast<const CEGUI::ListboxTextItem *>(_lb->getFirstSelectedItem());
	std::string txt = it->getText().c_str();
	if(txt == "New..")
	{
		_myChannels->show();
		CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
			(CEGUI::WindowManager::getSingleton().getWindow("Chat/chooseChannel/edit"));
		bed->activate();
		_myChat->setEnabled(false);
	}
	else if(txt == "Whisper..")
	{
		_myChooseName->show();
		CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
			(CEGUI::WindowManager::getSingleton().getWindow("Chat/choosePlayerName/edit"));
		bed->activate();
		_myChat->setEnabled(false);
	}
	else
	{
		CEGUI::PushButton * bch = static_cast<CEGUI::PushButton *>
			(CEGUI::WindowManager::getSingleton().getWindow("Chat/bChannel"));
		bch->setProperty("Text", it->getText());


		_currSelectedch= (int)_lb->getItemIndex(it);
	}

	_lb->hide();

	return true;
}
Beispiel #4
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));
}
void GameCoordinator::onSetCancel()
{
	// Ready Button
	CEGUI::PushButton* readyButton = static_cast<CEGUI::PushButton*>(CEGUI::System::getSingleton().getGUISheet()->getChildRecursive(
			"Game/Control/Set/ReadyButton"));
	if (readyButton)
		readyButton->setEnabled(false);
}
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 GameCoordinator::onSetReady()
{
	cout << "asdf" << endl;
	// Ready Button
	CEGUI::PushButton* readyButton = static_cast<CEGUI::PushButton*>(CEGUI::System::getSingleton().getGUISheet()->getChildRecursive(
			"Game/Control/Set/ReadyButton"));
	cout << "asdf2" << endl;
	if (readyButton)
		readyButton->setEnabled(true);
	cout << "asdf3" << endl;
}
Beispiel #8
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);
}
Beispiel #9
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));
}
Beispiel #10
0
/***********************************************************
add a channel to the chat
***********************************************************/
void ChatBox::AddChannel(const std::string & channel)
{
	std::list<std::string>::iterator it = std::find(_channels.begin(), _channels.end(), channel);
	if(it != _channels.end())
		return;

	_channels.push_back(channel);
	AddTab(channel);

	CEGUI::PushButton * bch = static_cast<CEGUI::PushButton *>
		(CEGUI::WindowManager::getSingleton().getWindow("Chat/bChannel"));
	bch->setProperty("Text", (const unsigned char *)channel.c_str());

	std::string tosend("/join ");
	tosend +=channel;
	ThreadSafeWorkpile::getInstance()->AddChatText(tosend);
}
Beispiel #11
0
/***********************************************************
add a whisper channel
***********************************************************/
void ChatBox::AddWhisperChanel(const std::string & name)
{
	std::string wchtmp = "w:" + name;

	if(std::find(_whisper_channels.begin(), _whisper_channels.end(), name) == _whisper_channels.end())
	{
		_whisper_channels.push_back(name);

		if(_whisper_channels.size() > 3)
			_whisper_channels.pop_front();
	}

	CEGUI::PushButton * bch = static_cast<CEGUI::PushButton *>
		(CEGUI::WindowManager::getSingleton().getWindow("Chat/bChannel"));

	bch->setProperty("Text", (const unsigned char *)wchtmp.c_str());
}
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);
}
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));
}
Beispiel #14
0
/***********************************************************
handle send button event
***********************************************************/
bool ChatBox::HandleSend (const CEGUI::EventArgs& e)
{
    CEGUI::PushButton * bch = static_cast<CEGUI::PushButton *>
		(CEGUI::WindowManager::getSingleton().getWindow("Chat/bChannel"));
	std::string curChannel = bch->getProperty("Text").c_str();

	CEGUI::Editbox * bed = static_cast<CEGUI::Editbox *>
		(CEGUI::WindowManager::getSingleton().getWindow("Chat/edit"));


	std::string currText = bed->getProperty("Text").c_str();
	if(currText != "")
	{
		SendText(curChannel, currText);
		bed->setProperty("Text", "");
	}

    return true;
}
Beispiel #15
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;
}
/************************************************************************
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;
}
Beispiel #17
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 );

}
Beispiel #18
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();
}
Beispiel #19
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();
}
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);
}
Beispiel #21
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));
}
Beispiel #22
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));  
}
Beispiel #23
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));
}
Beispiel #24
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));
}
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());
	}
}
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!");
}
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));

}
bool MinesweeperSample::boardDiscover(const Location& loc)
{
    CEGUI::PushButton* btn = d_buttons[loc.d_row][loc.d_col];
    if (btn->isDisabled() || btn->getID() > 0)
        return true;

    if (d_board[loc.d_row][loc.d_col] > 8)
        return false;
    d_buttons[loc.d_row][loc.d_col]->setText(CEGUI::PropertyHelper<CEGUI::uint>::toString(d_board[loc.d_row][loc.d_col]));
    d_buttons[loc.d_row][loc.d_col]->setEnabled(false);
    ++d_boardCellDiscovered;
    // Discover surrounding case
    if (d_board[loc.d_row][loc.d_col] == 0)
    {
        Location l;
        if (loc.d_row > 0)
        {
            l.d_row = loc.d_row - 1;
            if ( loc.d_col > 0)
            {
                l.d_col = loc.d_col - 1;
                boardDiscover(l);
            }
            l.d_col = loc.d_col;
            boardDiscover(l);
            if ( loc.d_col < MinesweeperSize - 1)
            {
                l.d_col = loc.d_col + 1;
                boardDiscover(l);
            }
        }
        l.d_row = loc.d_row;
        if ( loc.d_col > 0)
        {
            l.d_col = loc.d_col - 1;
            boardDiscover(l);
        }
        if ( loc.d_col < MinesweeperSize  - 1)
        {
            l.d_col = loc.d_col + 1;
            boardDiscover(l);
        }
        if (loc.d_row < MinesweeperSize - 1)
        {
            l.d_row = loc.d_row + 1;
            if ( loc.d_col > 0)
            {
                l.d_col = loc.d_col - 1;
                boardDiscover(l);
            }
            l.d_col = loc.d_col;
            boardDiscover(l);
            if ( loc.d_col < MinesweeperSize - 1)
            {
                l.d_col = loc.d_col + 1;
                boardDiscover(l);
            }
        }
    }
    return true;
}
Beispiel #29
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));//发送请求更新求购委托挂单列表


}