예제 #1
0
bool GUIManager::handleDSActivation ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  ListboxItem *item = static_cast<ListboxItem *>(lb->getFirstSelectedItem());
  if (item != NULL) {
    DataManager *dm = static_cast<DataManager *>(item->getUserData());
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    std::vector<unsigned int> const & dims = dm->getDimensions();
    unsigned int dim = dims[int(sb->getScrollPosition()*(dims.size()-1))];
    float scrollPos = sb->getScrollPosition();
    dm->activate(dim);
    // Enable global scrollbar
    CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
    sb = static_cast<CEGUI::Scrollbar *>(wm.getWindow("Sheet/DimensionSlider"));
    sb->enable();
    CEGUI::WindowEventArgs w(sb);
    sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
    // Set the global scrollbar to the right position.
    sb->setScrollPosition(scrollPos);
    CEGUI::Window *desc = wm.getWindow("Sheet/DimensionText");
    desc->show();
  }
  // TODO handle else-error
  return true;
}
예제 #2
0
void
EndState::enter ()
{
  _root = Ogre::Root::getSingletonPtr();
  _sceneMgr = _root->getSceneManager("SceneManager");
  _camera = _sceneMgr->getCamera("IntroCamera");
  _viewport = _root->getAutoCreatedWindow()->getViewport(0);
  _pSoundFXManager = SoundFXManager::getSingletonPtr();
  _simpleEffect = _pSoundFXManager->load("gameover.ogg");
  _simpleEffect->play();
  _exitGame = _save = false;

  _rec = new Record();
    //CEGUI
  CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().show();
  _sheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow","Menu");

  //Config Window
  CEGUI::Window* configWin = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("end.layout");
  CEGUI::Window* mark = configWin->getChild("MarkValue");
  mark->setText(Ogre::StringConverter::toString(_score));
  _nick = configWin->getChild("Nick");
  _nick->subscribeEvent(CEGUI::Window::EventMouseButtonDown,
			CEGUI::Event::Subscriber(&EndState::clear, this));
  CEGUI::Window* menuButton = configWin->getChild("MenuButton");
  menuButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&EndState::save, this));
  CEGUI::Window* exitButton = configWin->getChild("ExitButton");
  exitButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&EndState::quit, this));

  //Attaching buttons
  _sheet->addChild(configWin);
  CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(_sheet);
}
예제 #3
0
void MenuState::showMenuCegui()
{
	//Sheet
	CEGUI::Window* _ceguiSheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow","menu_principal");


	//Config Window
	CEGUI::Window* menuWin = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("menu_principal.layout");

	// NEW GAME
	CEGUI::Window* newGameButton = menuWin->getChild("btn_new_game");
	newGameButton->subscribeEvent( CEGUI::PushButton::EventClicked,
							   	   CEGUI::Event::Subscriber(&MenuState::newGame, this));
	// RECORDS
	CEGUI::Window* recordsButton = menuWin->getChild("btn_records");
	recordsButton->subscribeEvent( CEGUI::PushButton::EventClicked,
							   	   CEGUI::Event::Subscriber(&MenuState::records, this));

	// CREDITS
	CEGUI::Window* creditsButton = menuWin->getChild("btn_credits");
	creditsButton->subscribeEvent( CEGUI::PushButton::EventClicked,
							   	   CEGUI::Event::Subscriber(&MenuState::credits, this));
	// QUIT
	CEGUI::Window* exitButton = menuWin->getChild("btn_quit");
	exitButton->subscribeEvent(CEGUI::PushButton::EventClicked,
							   CEGUI::Event::Subscriber(&MenuState::quit, this));

	//Attaching buttons
	_ceguiSheet->addChild(menuWin);
	CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(_ceguiSheet);


}
예제 #4
0
void NextLevelState::createGUI()
{
  //CEGUI
  _sheet = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow","Menu");

  //Config Window
  CEGUI::Window* configWin = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("next.layout");
  CEGUI::Window* playButton = configWin->getChild("PlayButton");
  playButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&NextLevelState::play, this));
  /*CEGUI::Window* saveButton = configWin->getChild("SaveButton");
  saveButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&NextLevelState::save, this));
  CEGUI::Window* loadButton = configWin->getChild("LoadButton");
  loadButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&NextLevelState::load, this));*/
  CEGUI::Window* helpButton = configWin->getChild("HelpButton");
  helpButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&NextLevelState::help, this));
  CEGUI::Window* menuButton = configWin->getChild("MenuButton");
  menuButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&NextLevelState::menu, this));
  CEGUI::Window* exitButton = configWin->getChild("ExitButton");
  exitButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&NextLevelState::quit, this));

  //Attaching buttons
  _sheet->addChild(configWin);
  CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(_sheet);
}
void vis_settings_panel_impl::set_visible(bool visible)
{
    CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();

	if(root->getChild(btn_exit_name)) root->getChild(btn_exit_name)->setVisible(visible);
    if(root->getChild(setting_dlg))root->getChild(setting_dlg)->setVisible(visible);
}
예제 #6
0
  bool onBoundingBoxSpinnerChanged(const CEGUI::EventArgs &args) {
    using namespace CEGUI;
    m_Exit.setBoundingBox(CBoundingBox2d(Ogre::Vector2(dynamic_cast<Spinner*>(m_pContentRegion->getChild("posx"))->getCurrentValue(),
					dynamic_cast<Spinner*>(m_pContentRegion->getChild("posy"))->getCurrentValue()),
			  Ogre::Vector2(dynamic_cast<Spinner*>(m_pContentRegion->getChild("sizex"))->getCurrentValue(),
					dynamic_cast<Spinner*>(m_pContentRegion->getChild("sizey"))->getCurrentValue())));
    return true;
  }
예제 #7
0
/*bool NextLevelState::save(const CEGUI::EventArgs &e)
{
  return true;
}
bool NextLevelState::load(const CEGUI::EventArgs &e)
{
  return true;
  }*/
bool NextLevelState::help(const CEGUI::EventArgs &e)
{
  CEGUI::Window* configWin = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("help.layout");
  _help = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow","Menu");
  CEGUI::Window* helpText = configWin->getChild("HelpText");
  helpText->setText("El objetivo de Get the Cup es llevar a tu\nequipo hasta lo mas alto, y para ello\ndeberas guiar su escudo a traves de niveles y plataformas\nEn ellos encontraras obstaculos y rivales\nque querran impedir tus exitos. Tendras\nque evitarlos!Puedes controlar a tu\npersonaje con las siguientes teclas:");
  CEGUI::Window* exitButton = configWin->getChild("ExitButton");
  exitButton->subscribeEvent(CEGUI::PushButton::EventClicked,
  CEGUI::Event::Subscriber(&NextLevelState::back, this));
  _help->addChild(configWin);
  CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(_help);
  return true;
}
예제 #8
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));
}
예제 #9
0
 void CeguiScreenBase::_TryAttachButtonHandler(const CEGUI::Window& i_window, const CEGUI::String& i_name_path, CEGUI::uint i_id, bool i_command_button)
   {
   try
     {
     // Connect
     CEGUI::Window* p_connect_button = i_window.getChild(i_name_path);
     if (p_connect_button != nullptr)
       {
       p_connect_button->setID(i_id);
       if (i_command_button)
         {
         p_connect_button->subscribeEvent(CEGUI::PushButton::EventClicked,
           CEGUI::Event::Subscriber(&CeguiScreenBase::CommandButtonPressedHandler, static_cast<CeguiScreenBase*>(this)));
         }
       else
         {
         p_connect_button->subscribeEvent(CEGUI::PushButton::EventClicked,
           CEGUI::Event::Subscriber(&CeguiScreenBase::ButtonPressedHandler, static_cast<CeguiScreenBase*>(this)));
         }
       }
     }
   catch (CEGUI::UnknownObjectException&)
     {
     assert(false);
     }
   }
예제 #10
0
void LoginEvent::OnPageOpen(GamePage *pPage)
{
    CEGUI::Window *pLoginWindow = pPage->GetPageWindow();
    //设置账号编辑框并得到焦点
    CEGUI::Editbox *pIDEdit = static_cast<CEGUI::Editbox*>(pLoginWindow->getChild("LoginPage/Account"));
	/////////////////////////////////////////////////
	// zhaohang  2010/3/29 
	// 
	//读cdkey
	ifstream stream2;
	stream2.open("setup/cdkey.ini"); 
	if (stream2.is_open())
	{
		bool bRememberCdkey=false;
		stream2 >> bRememberCdkey;
		if (bRememberCdkey)
		{
			string str;
			stream2 >> str;
			pIDEdit->setText(str.c_str());

			//m_pRememberCdkey->SetSelected(true);
		}
		stream2.close();
	}
예제 #11
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();
}
예제 #12
0
bool CEGUIDrawable::handleClose( const CEGUI::EventArgs& e )
{
    CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();
    root->getChild("DemoWindow")->setVisible(false);
    return true;
}
예제 #13
0
bool time_panel_impl::visible()
{
    CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();
    return root->getChild(label_name)->isVisible();
    return true;
}
예제 #14
0
void time_panel_impl::set_visible(bool visible)
{
    CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();
    root->getChild(label_name)->setVisible(visible);

}
예제 #15
0
bool GUIManager::handleDSSelection ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
  DataManager *dm = static_cast<DataManager *>(
      lb->getFirstSelectedItem()->getUserData());
  _selectedDM = dm;
  std::vector<unsigned int> const & dim = dm->getDimensions();
  sb->setStepSize(1.0/float(dim.size()-1));
  sb->enable();
  CEGUI::WindowEventArgs w(sb);
  sb->fireEvent(CEGUI::Scrollbar::EventScrollPositionChanged, w);
  return true;
}
예제 #16
0
bool CREvent::OnCreateRoleBtn(const CEGUI::EventArgs &e)
{
	if (GetInst(SelectRolePage).GetPlayerCount() >= 1)
	{
        GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Base_34"));   //目前不能创建更多的角色了!
		return false;
	}
	CEGUI::Window *pPageWin = GetInst(CreateRolePage).GetPageWindow();
	CEGUI::Editbox* pNameEdit = static_cast<CEGUI::Editbox*>(pPageWin->getChild("EditName"));

	const char * strName = CEGUIStringToAnsiChar(pNameEdit->getText());
	if (strcmp(strName,"") == 0)
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Player_72"));  //"名字不能为空"
		return false;
	}
	if (!CheckName(strName))
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Player_73"));  //"名字中不能有空格"
		return false; 
	}
	int  iSex  = random(2);
	//RandomChoseDetails();
	//RandomChoseCountry();
	BYTE lConstellation = random(12) + 1;
	//const char *strName,char nOccupation, char nSex, BYTE lHead, BYTE lFace, BYTE lCountry,BYTE lConstellation,BYTE bRandCountry
	GetGame()->C2L_AddRole_Send(strName, 0, (char)GetSelectSex(), GetHair(), GetFace(), GetSelectCountry(), lConstellation, 0 );
	return true;
}
예제 #17
0
bool GUIManager::handleScrollbarChanged ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Scrollbar *scrollbar =
    static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  CEGUI::Window *desc = tab->getChild(1);
  DataManager *dm = static_cast<DataManager *>(
      lb->getFirstSelectedItem()->getUserData());
  std::vector<unsigned int> const & dims = dm->getDimensions();
  float f = static_cast<CEGUI::Scrollbar *>(scrollbar)->getScrollPosition();
  unsigned int dim = dims[int(f*(dims.size()-1))];
  std::ostringstream ss; ss << "Dimension: " << dim;
  desc->setText(ss.str());
  return true;
}
예제 #18
0
CEGUI::TabControl* getTabControl(const std::string& _prefix)
{
    CEGUI::Window* window = CEGUI::System::getSingletonPtr()->getGUISheet()->getChild(_prefix);
    //CEGUI::System::getSingleton().getGUISheet()->addChildWindow(window);
    CEGUI::Window* uncastTab = window->getChild(_prefix + "/TabControl");
    assert(dynamic_cast<CEGUI::TabControl*>(uncastTab));
    return static_cast<CEGUI::TabControl*>(uncastTab);
}
예제 #19
0
void GUISystem::FolderSelector::Show(const CEGUI::String& windowTitle, bool showEditbox, const CEGUI::String& editboxLabel)
{
    bool success = false;
    OC_CEGUI_TRY;
    {
        CEGUI::Window* root = gGUIMgr.GetGUISheet();

        mWindow = gGUIMgr.LoadSystemLayout("FolderSelector.layout", root->getName() + "/");
        mWindow->setAlwaysOnTop(true);
        mWindow->setModalState(true);
        root->addChildWindow(mWindow);

        CEGUI::Window* frame = mWindow->getChild(root->getName() + "/FolderSelector/Frame");
        frame->setText(windowTitle);

        mButtonOK = frame->getChild(root->getName() + "/FolderSelector/ButtonOK");
        mButtonCancel = frame->getChild(root->getName() + "/FolderSelector/ButtonCancel");
        mPathBox = frame->getChild(root->getName() + "/FolderSelector/PathBox");
        mFolderList = static_cast<CEGUI::Listbox*>(frame->getChild(root->getName() + "/FolderSelector/FolderList"));
        mFolderList->setWantsMultiClickEvents(true);
        mEditbox = frame->getChild(root->getName() + "/FolderSelector/Editbox");
        mEditbox->subscribeEvent(CEGUI::Editbox::EventKeyDown,
                                 CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnEditboxKeyDown, this));
        mButtonOK->subscribeEvent(CEGUI::PushButton::EventClicked,
                                  CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnButtonClicked, this));
        mButtonCancel->subscribeEvent(CEGUI::PushButton::EventClicked,
                                      CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnButtonClicked, this));
        mFolderList->subscribeEvent(CEGUI::Listbox::EventMouseDoubleClick,
                                    CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnFolderListDoubleClicked, this));

        CEGUI::Window* buttonCreateDirectory = frame->getChild(root->getName() + "/FolderSelector/ButtonCreateDirectory");
        buttonCreateDirectory->subscribeEvent(CEGUI::PushButton::EventClicked,
                                              CEGUI::Event::Subscriber(&GUISystem::FolderSelector::OnCreateDirectoryClicked, this));

        if (!showEditbox)
        {
            mEditbox->hide();
            frame->getChild(root->getName() + "/FolderSelector/EditboxLabel")->hide();
        }
        else
        {
            frame->getChild(root->getName() + "/FolderSelector/EditboxLabel")->setText(editboxLabel);
            mEditbox->activate();
        }

        UpdateFolderList();
        success = true;
    }
    OC_CEGUI_CATCH;

    if (!success)
    {
        ocError << "Cannot show FolderSelector.";
        delete this;
    }
}
예제 #20
0
bool OnUpdateLatestBuy(const CEGUI::EventArgs& e)
{
    CEGUI::Window* wnd = WEArgs(e).window;
    //先把图片清掉 ,默认为十个条目
    char name[256] = "";
    for(uint i = 0 ; i < 10 ; ++i)
    {
        sprintf(name,SHOPCITY_LATESTBUY_ITME_NAME_D,i);
        CEGUI::Window* temp = wnd->getChild(name);
        if(temp)
        {
            temp->setProperty("Image","");
            OutputDebugStr(temp->getName().c_str());
            OutputDebugStr("\n");
        }
    }

    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    SCGData::MapSBT10& personal = dt->GetSelfBuyTop10();
    SCGData::VecGDPTA perDTA = personal[eCityType];

    size_t count = perDTA.size();
    for(size_t i = 0 ; i < count ; ++i)
    {
        char name[256] = "";
        sprintf(name,SHOPCITY_LATESTBUY_ITME_NAME_D,i);
        CEGUI::Window* temp = wnd->getChild(name);
        if(temp)
        {
            CGoodsList::tagGoods2* tg2 = CGoodsList::GetProperty(perDTA[i].index);
            if(tg2)
            {
                char imagesetname[256];
                sprintf(imagesetname,GOODS_PREFIXID,tg2->BaseProperty.dwIconId);
                CEGUI::String imagename = CEGUI::PropertyHelper::intToString(tg2->BaseProperty.dwIconId)+".jpg";
                SetBackGroundImage(WGUISheet(temp),imagesetname,GOODS_ICON_PATH,imagename.c_str());
            }
        }
    }
    return true;
}
예제 #21
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;
}
void vis_settings_panel_impl::set_light(bool on)
{
    CEGUI::GUIContext& context = CEGUI::System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();
    if (root->isChild(setting_dlg + "/Settings/chkLights"))
    {
        ToggleButton* button = static_cast<ToggleButton*>(root->getChild(setting_dlg + "/Settings/chkLights"));
        return button->setSelected(on);
    }
}
예제 #23
0
bool GUIManager::handleDSDeactivation ( CEGUI::EventArgs const & e )
{
  CEGUI::Window *tab =
    static_cast<CEGUI::WindowEventArgs const &>(e).window->getParent();
  CEGUI::Listbox *lb = static_cast<CEGUI::Listbox *>(tab->getChild(0));
  ListboxItem *item = static_cast<ListboxItem *>(lb->getFirstSelectedItem());
  if (item != NULL) {
    DataManager *dm = static_cast<DataManager *>(item->getUserData());
    dm->deactivate();
    // Enable global scrollbar
    CEGUI::WindowManager & wm = CEGUI::WindowManager::getSingleton();
    CEGUI::Scrollbar *sb = static_cast<CEGUI::Scrollbar *>(tab->getChild(2));
    sb = static_cast<CEGUI::Scrollbar *>(wm.getWindow("Sheet/DimensionSlider"));
    sb->disable();
    CEGUI::Window *desc = wm.getWindow("Sheet/DimensionText");
    desc->hide();
  }
  // TODO handle else-error
  return true;
}
예제 #24
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();
}
예제 #25
0
파일: HUDemo.cpp 프로젝트: scw000000/Engine
int GamePlate::getPoints()
{
    CEGUI::Window* window = d_window->getChild("ImageWindowObject");

    CEGUI::String objectImage = window->getProperty("Image");

    if(objectImage.compare(HUDDemo::s_imageNameBread) == 0)
        return 2;
    else if(objectImage.compare(HUDDemo::s_imageNamePoo) == 0)
        return -6;
    else if(objectImage.compare(HUDDemo::s_imageNameSteak) == 0)
        return -13;
    else if(objectImage.compare(HUDDemo::s_imageNamePrizza) == 0)
        return 3;
    else if(objectImage.compare(HUDDemo::s_imageNameVegPeople) == 0)
        return 1;
    else if(objectImage.compare(HUDDemo::s_imageNameVegFruits) == 0)
        return 88;

    return 0;
}
예제 #26
0
InputContext* DynamicEditor::EditorFactoryType::createEditor(CEGUI::TabControl* _tab, std::string _factoryName, std::string _typeName, DynamicEditor* _editor)
{
    CEGUI::Window* page = CEGUI::WindowManager::getSingletonPtr()->loadWindowLayout("EntityInstanceTab.layout", _factoryName);

    FactoryParameters* params = new FactoryParameters(true);
    DynamicEditorMode* editorMode = modeFactory->createMode(page, params);

    CEGUI::Window* typeNameDisplay = page->getChild(_factoryName + "Tab/EntityTypeName");
    typeNameDisplay->appendText(_typeName);
    page->setProperty("Text",_factoryName);
    _tab->addTab(page);
    page->setUserData(editorMode);

    editorMode->initEditorMode(_factoryName, _editor);

    float uiElementTop = 0.0f;
    for (auto i = instanceVariableFactories.begin(); i != instanceVariableFactories.end(); i++)
    {
        DynamicEditorVariable* editorVar = (*i)->createVariable(editorMode->getWindow(),params->getTypeTable(), _factoryName, &uiElementTop);
        editorMode->addVariable((*i)->getName(), editorVar);
    }

    return editorMode;
}
예제 #27
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));

}
예제 #28
0
	/**
	Handles openening of the scene outliner tab
	*/
	inline bool ViewSceneOutliner(const CEGUI::EventArgs& e)
	{
		Root->getChild("Frame2")->show();
		return 1;
	}
예제 #29
0
DynamicEditor::EditorFactoryType* DynamicEditor::searchExistingFactoryInstances(const std::string& factoryName)
{
    AbstractFactoryBase<Entity>* factory = nullptr; /// FIXME AbstractFactories::global().getFactory<Entity>(factoryName);
    EditorFactoryType* editor = nullptr;
    {
        FactoryParameters _parameters(true);
        deadBodies.push_back(factory->use(&_parameters, nullptr));
        std::vector<std::string> values = _parameters.getUndefinedLog(); /// FIXME this could be faster, its stored as a map internally, we could sort it
        for (auto editorMode = editorModes.begin(); editorMode != editorModes.end(); editorMode++)
        {
            unsigned int matches = 0;
            std::vector<std::vector<std::string>::iterator> matchedStrings; /// Keep a track of these so we can delete them in case of a complete match
            for (auto string = editorMode->first.begin(); string != editorMode->first.end(); string++)
            {
                for (auto value = values.begin(); value != values.end(); value++)
                {
                    if (*value == *string)
                    {
                        matches++;
                        matchedStrings.push_back(value);
                        break;
                    }
                }
            }
            if (matches == editorMode->first.size())
            {
                editor = new EditorFactoryType(editorMode->second, this, factoryName);
                while (!matchedStrings.empty())
                {
                    values.erase(matchedStrings.back());
                    matchedStrings.pop_back();
                }
                for (auto value = values.begin(); value != values.end(); value++)
                {
                    auto variable = editorVariables.find(*value);
                    if (variable != editorVariables.end())
                    {
                        editor->addInstanceVariableFactory(variable->second);
                    }
                }
                editor->addInstanceVariableFactory(nameVariableControllerFactory);
                //break;
                goto MATCH_FOUND;
            }
        }
    }
    return nullptr;
MATCH_FOUND:
    TextFileFactoryLoader loader(nullptr, nullptr, true); /// FIXME
    FactoryGetList getList;
    ///Events::global().registerListener<FactoryGetEvent<Entity>>(&getList,{eBlockQueue}); FIXME this is now missing
    //factory->baseInit(factoryName, &loader, &AbstractFactories::global());
    ///Events::global().unregisterListener<FactoryGetEvent<Entity>>(&getList, true);
    std::vector<std::string> values = loader.getUndefinedLog();
    FactoryParameters* params = new FactoryParameters(nullptr);
    CEGUI::Window* page = CEGUI::WindowManager::getSingletonPtr()->loadWindowLayout("EntityTypeTab.layout", factoryName);
    page = page->getChild(factoryName + "Properties");
    float uiElementTop = 0.f;
    for (auto value = values.begin(); value != values.end(); value++)
    {
        auto variable = editorVariables.find(*value);
        if (variable != editorVariables.end())
        {
            editor->addTypeVariable(variable->second->createVariable(page, params->getTypeTable(),factoryName, &uiElementTop));
        }
        else
        {
            TextEditBoxFactory factory(*value, "");
            editor->addTypeVariable(factory.createVariable(page, params->getTypeTable(),factoryName, &uiElementTop));
        }
    }
    page->setProperty("Text",factoryName);
    typeTab->addTab(page);

    page->setUserData(editor);

    CEGUI::Window* factoryNameBox = typeTab->getParent()->getChild("Root/EntityTypes/NewFactoryName");
    editor->setInstanceNameWidget(factoryNameBox);
    return editor;
}
void CEGUIManager::init() {
	CEGUI::OpenGLRenderer &m_renderer =
		CEGUI::OpenGLRenderer::bootstrapSystem();

	{
		// initialise the required dirs for the DefaultResourceProvider
		CEGUI::DefaultResourceProvider *resourceProvider = static_cast<CEGUI::DefaultResourceProvider*>
			(CEGUI::System::getSingleton().getResourceProvider());

		// set resource group directories.
		{
			CEGUI::DefaultResourceProvider* rp = resourceProvider;
			rp->setResourceGroupDirectory("schemes", "datafiles/schemes/");
			rp->setResourceGroupDirectory("imagesets", "datafiles/imagesets/");
			rp->setResourceGroupDirectory("fonts", "datafiles/fonts/");
			rp->setResourceGroupDirectory("layouts", "datafiles/layouts/");
			rp->setResourceGroupDirectory("looknfeels", "datafiles/looknfeel/");
			rp->setResourceGroupDirectory("lua_scripts", "datafiles/lua_scripts/");
		}

		// set default resource groups.
		{
			CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");
			CEGUI::Font::setDefaultResourceGroup("fonts");
			CEGUI::Scheme::setDefaultResourceGroup("schemes");
			CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
			CEGUI::WindowManager::setDefaultResourceGroup("layouts");
			CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
			// setup default group for validation schemas
			CEGUI::XMLParser* parser = CEGUI::System::getSingleton().getXMLParser();
			if (parser->isPropertyPresent("SchemaDefaultResourceGroup"))
				parser->setProperty("SchemaDefaultResourceGroup", "schemas");


			CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
			CEGUI::SchemeManager::getSingleton().createFromFile("GameMenu.scheme");
			CEGUI::SchemeManager::getSingleton().createFromFile("Generic.scheme");
			CEGUI::SchemeManager::getSingleton().createFromFile("HUDDemo.scheme");
			CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
			CEGUI::SchemeManager::getSingleton().createFromFile("TestA.scheme");

			
		}

		// Register custom objects with CEGUI:
		{
			// register custom objects with CEGUI.
			CEGUI::WindowFactoryManager::addFactory<CEGUI::TplWindowFactory<CEGUI::InventoryReceiver>>();
			CEGUI::WindowFactoryManager::addFactory<CEGUI::TplWindowFactory<CEGUI::InventoryItem>>();
			CEGUI::WindowRendererManager::addFactory<CEGUI::TplWindowRendererFactory<CEGUI::InventoryItemRenderer>>();

			// load looknfeel for custom inventory components (needs TaharezLook images)
			CEGUI::WidgetLookManager::getSingleton().parseLookNFeelSpecificationFromFile("InventoryComponents.looknfeel");

			// create mapping for the item type
			// This is the equivalent to the following entry in a scheme xml file:
			// <FalagardMapping WindowType="TaharezLook/InventoryItem" TargetType="InventoryItem" LookNFeel="TaharezLook/InventoryItem" Renderer="InventoryItemRenderer" />
			CEGUI::WindowFactoryManager::getSingleton().addFalagardWindowMapping(
				"TaharezLook/InventoryItem",    // type to create
				"InventoryItem",                // 'base' widget type
				"TaharezLook/InventoryItem",    // WidgetLook to use.
				"InventoryItemRenderer");       // WindowRenderer to use.
		}
	}

	CEGUI::System::getSingleton().getDefaultGUIContext().
		getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");

	// Create windows
	{
		CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();


		CEGUI::Window* root = CEGUI::WindowManager::getSingleton().loadLayoutFromFile("test2.layout"); // test.layout
		CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(root);


		//CEGUI::Window *dragContainerTemplate = CEGUI::WindowManager::getSingleton().loadLayoutFromString(CEGUI::String(
		//	"<Window type = \"Generic/Image\" name = \"Image\" >"
		//	"	<Property name = \"Area\" value = \"{{0,0},{0,0},{0,64},{0,128}}\" / >"
		//	"	<Property name = \"Image\" value = \"TestA2/MadBug\" / >"
		//	"	<Property name = \"MaxSize\" value = \"{{1,0},{1,0}}\" / >"
		//	"	<Property name = \"ClippedByParent\" value = \"false\" / >"
		//	"	<Property name = \"VerticalAlignment\" value = \"Centre\" / >"
		//	"	<Property name = \"HorizontalAlignment\" value = \"Centre\" / >"
		//	"	<Property name = \"MousePassThroughEnabled\" value = \"true\" / >"
		//	"< / Window>"));

		//for (int i = 0; i < 10; ++i) {

		//}
		

		//// create a script module.
		//CEGUI::LuaScriptModule& scriptmod(CEGUI::LuaScriptModule::create());

		//// tell CEGUI to use this scripting module
		//CEGUI::System::getSingleton().setScriptingModule(&scriptmod);


		//CEGUI::System::getSingleton().executeScriptFile("test2.lua");



		// Inventory testing:
		{
			// Create Backpack window

			CEGUI::Window *inventoryImageWindow = root->getChild("Inventory");
			CEGUI::Window* wnd = inventoryImageWindow;//wmgr.createWindow("TaharezLook/FrameWindow");
			//root->addChild(wnd);
			/*wnd->setPosition(CEGUI::UVector2(CEGUI::UDim(0.1f, 0), CEGUI::UDim(0.1f, 0)));
			wnd->setSize(CEGUI::USize(CEGUI::UDim(0.2f, 0), CEGUI::UDim(0.4f, 0)));*/
			wnd->setText("Backpack");

			CEGUI::InventoryReceiver& receiver1 = dynamic_cast<CEGUI::InventoryReceiver&>(*wmgr.createWindow("InventoryReceiver"));
			wnd->addChild(&receiver1);
			receiver1.setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f)));
			receiver1.setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_reldim(1.0f)));
			receiver1.setContentSize(20, 2);
			receiver1.setUserString("BlockImage", "TestA2/InventorySlot");

			// Create vault window
			CEGUI::Window* wnd2 = wmgr.createWindow("TestA2/InventoryWindow");
			root->addChild(wnd2);
			wnd2->setPosition(CEGUI::UVector2(CEGUI::UDim(0.48f, 0), CEGUI::UDim(0.2f, 0)));
			wnd2->setSize(CEGUI::USize(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.5f, 0)));
			wnd2->setText("Bank Vault");

			CEGUI::InventoryReceiver& receiver2 = dynamic_cast<CEGUI::InventoryReceiver&>(*wmgr.createWindow("InventoryReceiver"));
			wnd2->addChild(&receiver2);
			receiver2.setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f)));
			receiver2.setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_reldim(1.0f)));
			receiver2.setContentSize(10, 10);
			receiver2.setUserString("BlockImage", "TestA2/InventorySlot");

			// create some items and add them to the vault.
			CEGUI::InventoryItem& item1 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("TaharezLook/InventoryItem"));
			item1.setContentSize(2, 2);
			receiver2.addItemAtLocation(item1, 0, 0);
			item1.setProperty("Image", "TaharezLook/MouseArrow");

			CEGUI::InventoryItem& item2 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("TaharezLook/InventoryItem"));
			item2.setContentSize(1, 2);
			receiver2.addItemAtLocation(item2, 1, 3);
			item2.setProperty("Image", "TestA2/MadBug");

			CEGUI::InventoryItem& item3 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("InventoryItem"));
			item3.setUserString("BlockImage", "TaharezLook/GenericBrush");
			item3.setContentSize(1, 4);
			receiver2.addItemAtLocation(item3, 5, 2);

			CEGUI::InventoryItem& item4 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("InventoryItem"));
			item4.setUserString("BlockImage", "TaharezLook/GenericBrush");
			item4.setContentSize(1, 1);
			receiver2.addItemAtLocation(item4, 8, 6);

			CEGUI::InventoryItem& item5 = dynamic_cast<CEGUI::InventoryItem&>(*wmgr.createWindow("InventoryItem"));
			item5.setUserString("BlockImage", "TaharezLook/GenericBrush");
			item5.setContentSize(2, 3);
		}

	}

}