예제 #1
0
PauseState::PauseState()
{
    m_bQuit             = false;
    m_bQuestionActive   = false;
    m_FrameEvent        = Ogre::FrameEvent();
	
	// Create CEGUI interface!
	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
	sheet = wmgr.createWindow("DefaultWindow", "PauseMenu/Sheet");

	CEGUI::Window *resume = wmgr.createWindow("TaharezLook/Button", "PauseMenu/ResumeButton");
	resume->setText("Resume");
	resume->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.45, 0)));
	resume->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0)));
	resume->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &PauseState::onResume, this));

	CEGUI::Window *menu = wmgr.createWindow("TaharezLook/Button", "PauseMenu/MenuButton");
	menu->setText("Back To Menu");
	menu->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.5, 0)));
	menu->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0)));
	menu->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &PauseState::onMenu, this));
	
	sheet->addChildWindow(resume);
	sheet->addChildWindow(menu);
}
예제 #2
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);


}
예제 #3
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);
}
예제 #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);
}
예제 #5
0
MenuState::MenuState()
{
    m_bQuit         = false;
    m_FrameEvent    = Ogre::FrameEvent();
	
	// Create CEGUI interface!
	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
	sheet = wmgr.createWindow( "DefaultWindow", "MainMenu/Sheet");

	CEGUI::ImagesetManager::getSingleton().createFromImageFile("BG", "mainMenuBackground.png");
	CEGUI::Window* menuBackground = wmgr.createWindow("TaharezLook/StaticImage", "MainMenu/BG");
	menuBackground->setProperty( "Image", "set:BG image:full_image");
	menuBackground->setSize(CEGUI::UVector2(CEGUI::UDim(0.0, 1440.0), CEGUI::UDim(0.0, 900.0)));
	menuBackground->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.0, 0.0), CEGUI::UDim( 0.0, 0.0)));
	menuBackground->setProperty( "FrameEnabled", "False");

	CEGUI::ImagesetManager::getSingleton().createFromImageFile("Loading", "loading.png");
	loading = wmgr.createWindow("TaharezLook/StaticImage", "MainMenu/Loading");
	loading->setProperty( "Image", "set:Loading image:full_image");
	loading->setSize(CEGUI::UVector2(CEGUI::UDim(0.0, 512.0), CEGUI::UDim(0.0, 128.0)));
	loading->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.5, -256.0), CEGUI::UDim( 0.5, -64.0)));
	loading->setProperty( "FrameEnabled", "False");
	loading->setProperty( "BackgroundEnabled", "False");

	CEGUI::ImagesetManager::getSingleton().createFromImageFile("NeuroPulseLogo", "neuroPulseLogo_1.png");
	CEGUI::Window* neuroPulseLogo = wmgr.createWindow("TaharezLook/StaticImage", "MainMenu/Logo");
	neuroPulseLogo->setProperty( "Image", "set:NeuroPulseLogo image:full_image");
	neuroPulseLogo->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.5, -275.0), CEGUI::UDim( 0.1, 0)));
	neuroPulseLogo->setSize(CEGUI::UVector2(CEGUI::UDim(0.0, 550.0), CEGUI::UDim(0.0, 200.0)));
	neuroPulseLogo->setProperty( "FrameEnabled", "False");
	neuroPulseLogo->setProperty( "BackgroundEnabled", "False");

	CEGUI::Window *play = wmgr.createWindow("TaharezLook/Button", "MainMenu/PlayButton");
	play->setText("Play");
	play->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.45, 0)));
	play->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0)));
	play->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &MenuState::onPlay, this));

	CEGUI::Window *options = wmgr.createWindow("TaharezLook/Button", "MainMenu/OptionsButton");
	options->setText("Options");
	options->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.5, 0)));
	options->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0)));
	options->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &MenuState::onOptions, this));

	CEGUI::Window *quit = wmgr.createWindow("TaharezLook/Button", "MainMenu/QuitButton");
	quit->setText("Quit");
	quit->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.4, 0), CEGUI::UDim( 0.55, 0)));
	quit->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.04, 0)));
	quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber( &MenuState::onQuit, this));
	
	sheet->addChildWindow(menuBackground);
	sheet->addChildWindow(neuroPulseLogo);
	sheet->addChildWindow(play);
	sheet->addChildWindow(options);
	sheet->addChildWindow(quit);
}
예제 #6
0
void GameMenuDemo::setupButtonClickHandlers()
{
    CEGUI::Window* buttonSave = d_root->getChild("InnerButtonsContainer/ButtonSave");
    buttonSave->subscribeEvent(CEGUI::Window::EventMouseClick, Event::Subscriber(&GameMenuDemo::handleStartPopupLinesSaveDisplay, this));
    CEGUI::Window* buttonLoad = d_root->getChild("InnerButtonsContainer/ButtonLoad");
    buttonLoad->subscribeEvent(CEGUI::Window::EventMouseClick, Event::Subscriber(&GameMenuDemo::handleStartPopupLinesLoadDisplay, this));
    CEGUI::Window* buttonCharacters = d_root->getChild("InnerButtonsContainer/ButtonCharacters");
    buttonCharacters->subscribeEvent(CEGUI::Window::EventMouseClick, Event::Subscriber(&GameMenuDemo::handleStartPopupLinesCharactersDisplay, this));
    CEGUI::Window* buttonOptions = d_root->getChild("InnerButtonsContainer/ButtonOptions");
    buttonOptions->subscribeEvent(CEGUI::Window::EventMouseClick, Event::Subscriber(&GameMenuDemo::handleStartPopupLinesOptionsDisplay, this));
    CEGUI::Window* buttonQuit = d_root->getChild("InnerButtonsContainer/ButtonQuit");
    buttonQuit->subscribeEvent(CEGUI::Window::EventMouseClick, Event::Subscriber(&GameMenuDemo::handleStartPopupLinesQuitDisplay, this));
}
예제 #7
0
fruitapp::gui::ce::button::button(
	fruitlib::audio::sound_controller &_sound_controller,
	CEGUI::Window &_window)
:
	sound_controller_(
		_sound_controller
	),
	push_connection_(
		_window.subscribeEvent(
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber(
				[
					this
				](
					CEGUI::EventArgs const &
				)
				-> bool
				{
					push_signal_();

					sound_controller_.play(
						fruitlib::resource_tree::path(
							FCPPT_TEXT("button_clicked")
						)
					);

					return
						true;
				}
			)
		)
	),
	hover_connection_(
		_window.subscribeEvent(
			CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber(
				[](
					CEGUI::EventArgs const &
				)
				-> bool
				{
					return
						true;
				}
			)
		)
	),
	push_signal_()
{
}
예제 #8
0
파일: HUDemo.cpp 프로젝트: scw000000/Engine
void HUDDemo::createScorePopup(const CEGUI::Vector2<float>& mousePos, int points)
{
    CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();

    CEGUI::Window* popupWindow = winMgr.createWindow("HUDDemo/PopupLabel");
    d_rootIngame->addChild(popupWindow);
    popupWindow->setPosition(CEGUI::UVector2(cegui_absdim(mousePos.d_x), cegui_absdim(mousePos.d_y)));
    popupWindow->setText(CEGUI::PropertyHelper<int>::toString(points));
    popupWindow->setRiseOnClickEnabled(false);
    popupWindow->subscribeEvent(AnimationInstance::EventAnimationEnded, Event::Subscriber(&HUDDemo::handleScorePopupAnimationEnded, this));
    popupWindow->setPixelAligned(false);
    popupWindow->setFont("DejaVuSans-14");

    popupWindow->setPosition(popupWindow->getPosition() + CEGUI::UVector2(cegui_reldim(0.03f), cegui_reldim(-0.02f)));

    if(points < 0)
        popupWindow->setProperty("NormalTextColour", "FF880000");
    else
    {
        popupWindow->setText( "+" + popupWindow->getText());
        popupWindow->setProperty("NormalTextColour", "FF006600");
    }

    CEGUI::EventArgs args;
    popupWindow->fireEvent("StartAnimation", args);
}
예제 #9
0
bool
IntroState::info(const CEGUI::EventArgs &e)
{
  CEGUI::Window* sheet=CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();
  _credits=false;
  _options=false;
  _info=true;

  //Sheet Creditos
  Window* sheetBG =  WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","background_info");
  sheetBG->setPosition( UVector2(cegui_reldim(0),cegui_reldim(0)));
  sheetBG->setSize( USize(cegui_reldim(1),cegui_reldim(1)));
  sheetBG->setProperty("Image","BackgroundImageControls");
  sheetBG->setProperty("FrameEnabled","False");
  sheetBG->setProperty("BackgroundEnabled", "False");

  CEGUI::Window* backButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","back");
  backButton->setText("[font='DickVanDyke'] Back ");
  backButton->setSize(CEGUI::USize(CEGUI::UDim(0.23,0),CEGUI::UDim(0.07,0)));
  backButton->setXPosition(UDim(0.66f, 0.0f));
  backButton->setYPosition(UDim(0.85f, 0.0f));
  backButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&IntroState::back,this));
  
  sheetBG->addChild(backButton);
  sheet->addChild(sheetBG);
  return true;
}
예제 #10
0
void PlayState::createGUIInfo()
{
  CEGUI::Window* btnNext = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/NextButton");
  btnNext->setText ("NEXT");
  btnNext->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0)));
  btnNext->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.01,0), CEGUI::UDim (0.01, 0)));
  btnNext->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::siguiente, this));
  CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnNext);
    
  CEGUI::Window* txtPuntos = CEGUI::WindowManager::getSingleton().createWindow ("TaharezLook/StaticText", "txtPuntos");
  std::stringstream s;
  s << "Puntos: " << _jugadores[_idJugador]->_puntuacion;
  txtPuntos->setText (s.str());
  txtPuntos->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0)));
  txtPuntos->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.20,0), CEGUI::UDim (0.01, 0)));
  CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(txtPuntos);

  CEGUI::Window* txtMov = CEGUI::WindowManager::getSingleton().createWindow ("TaharezLook/StaticText", "txtMov");
  s.str("");;
  s << "Movimiento: [" << _jugadores[_idJugador]->_casillaTiro.x << "," << _jugadores[_idJugador]->_casillaTiro.y << "]";
  txtMov->setText (s.str());
  txtMov->setSize (CEGUI::USize (CEGUI::UDim (0.30, 0), CEGUI::UDim (0.05, 0)));
  txtMov->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.39,0), CEGUI::UDim (0.01, 0)));
  CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(txtMov);
}
예제 #11
0
void MessageBox::SetButtons(const MessageBoxButtons& buttons)
{
	float32 sumWidth = 0;
	for (MessageBoxButtons::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
	{
		CEGUI::Window* button = GetButton(*it);
		OC_DASSERT(button != 0);
		float32 width = button->getWidth().d_offset;
		sumWidth += width;
	}

	float32 totalWidth = sumWidth + BUTTON_MARGIN * (buttons.size() - 1);

	float32 left = 0;
	for (MessageBoxButtons::const_iterator it = buttons.begin(); it != buttons.end(); ++it)
	{
		CEGUI::Window* button = GetButton(*it);
		OC_DASSERT(button != 0);
		float32 width = button->getWidth().d_offset;

		button->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, -0.5f * totalWidth + left), button->getPosition().d_y));
		button->setWidth(CEGUI::UDim(0, width));
		button->setVisible(true);
		button->setID((CEGUI::uint)*it);
		button->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUISystem::MessageBox::OnButtonClicked, this));
		
		left += width + BUTTON_MARGIN;
	}

	mMinWidth = totalWidth + 2.0f * BUTTON_MARGIN;
}
예제 #12
0
//-------------------------------------------------------------------------------------
void TutorialApplication::createScene(void)
{
    mRenderer = &CEGUI::OgreRenderer::bootstrapSystem();

	CEGUI::ImageManager::setImagesetDefaultResourceGroup("Imagesets");
	CEGUI::Font::setDefaultResourceGroup("Fonts");
	CEGUI::Scheme::setDefaultResourceGroup("Schemes");
	CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
	CEGUI::WindowManager::setDefaultResourceGroup("Layouts");

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

	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
	CEGUI::Window *sheet = wmgr.createWindow("DefaultWindow", "Main");
	
	CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(sheet);

	CEGUI::Window *quit = wmgr.createWindow("TaharezLook/Button", "QuitButton");

	quit->setText("Quit");
	quit->setSize(CEGUI::USize(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0)));
	quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&TutorialApplication::quit, this));

	sheet->addChild(quit);
}
예제 #13
0
void ActiveWidgetHandler::Input_InputModeChanged(Input::InputMode mode)
{
	if (mode != Input::IM_GUI && mLastMode == Input::IM_GUI) {
		//save the current active widget
		CEGUI::Window* window = mGuiManager.getMainSheet()->getActiveChild();
		if (window) {
			mLastActiveWindow = window;
			mLastActiveWindowDestructionStartedConnection = window->subscribeEvent(CEGUI::Window::EventDestructionStarted, CEGUI::Event::Subscriber(&ActiveWidgetHandler::lastActiveWindowDestructionStarted, this));
			window->deactivate();
			//deactivate all parents
			while ((window = window->getParent())) {
				window->deactivate();
			}
		} else {
			mLastActiveWindow = nullptr;
		}
		mLastMode = mode;
	} else if (mode == Input::IM_GUI) {
		if (mLastActiveWindow) {
			//restore the previously active widget
			try {
				mLastActiveWindow->activate();
			} catch (...)
			{
				S_LOG_WARNING("Error when trying to restore previously captured window.");
			}
			mLastActiveWindow = 0;
			mLastActiveWindowDestructionStartedConnection->disconnect();
		}
		mLastMode = mode;
	}
}
예제 #14
0
DynamicEditor::DynamicEditor(FreeCamera* camera, EditorMode* _mode)
:editorModes
({
    {{"position","dimensions"}, new DynamicEditor::DerivedModeFactory<BoxDragMode>()},
    {{"points"}, new DynamicEditor::DerivedModeFactory<PointGeometryMode>()},
    {{"position", "radius"}, new DynamicEditor::DerivedModeFactory<CircleDragMode>()},
    {{"position"}, new DynamicEditor::DerivedModeFactory<ClickPlaceMode>()},
}),
editorVariables
({
    {"skin", new ComponentObjectSelectionVariableFactory<Skin>("skin","StaticSkinFactory")},
}),
params(nullptr)
{
    //ctor
    //entityList = new EntityList("Root/EntityList/Listbox");
    camera->activate();
    mCamera = camera;
    instanceTab = getTabControl("Root/Entities");
    typeTab = getTabControl("Root/EntityTypes");
    entityName = CEGUI::System::getSingleton().getGUISheet()->getChildRecursive("Root/Entities/EntityName");
    //nameVariableController = new NameVariableController(entityName, &params);
    nameVariableControllerFactory = new NameVariableControllerFactory("ThisIsAName", entityName);
    assert(entityName);
    instanceTab->getParent()->setEnabled(false);
    typeTab->getParent()->setEnabled(false);
    instanceTab->getParent()->setVisible(false);
    typeTab->getParent()->setVisible(false);

    CEGUI::Window* button = typeTab->getParent()->getChild("Root/EntityTypes/CreateButton");
    button->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::SubscriberSlot(&DynamicEditor::createFactory,this));
    editorMode = _mode;
}
예제 #15
0
/***********************************************************
resize inventory
***********************************************************/
void ContainerBox::ResizeInventory(int newsize)
{
	if(_inventory_size == newsize)
		return;

	_inventory_size = newsize;
	for(size_t i=0; i<_inv_boxes.size(); ++i)
		_inv_boxes[i]->destroy();

	_inv_boxes.clear();


	CEGUI::Window*	pane = CEGUI::WindowManager::getSingleton().getWindow("ContainerFrame/InvScrollable");
	CEGUI::Window*	tmpwindow;
	for(int i=0; i<_inventory_size; ++i)
	{
		int x = i / 4;
		int y = i % 4;

		tmpwindow = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticText");
		tmpwindow->setArea(CEGUI::UDim(0,5+((float)_boxsize+2)*y), CEGUI::UDim(0,5+((float)_boxsize+2.0f)*x),
							CEGUI::UDim(0, (float)_boxsize), CEGUI::UDim(0, (float)_boxsize));
		pane->addChildWindow(tmpwindow);

        tmpwindow->subscribeEvent(
					CEGUI::Window::EventDragDropItemDropped,
					CEGUI::Event::Subscriber(&ContainerBox::handle_ItemDroppedInInventory, this));

		tmpwindow->setID(i);
		_inv_boxes.push_back(tmpwindow);
	}

	CleanInventory();
}
예제 #16
0
파일: PromptBox.cpp 프로젝트: Ocerus/Ocerus
void PromptBox::SetLabel(const CEGUI::String& text)
{
	OC_CEGUI_TRY;
	{
		CEGUI::Window* messageText = mPromptBox->getChild(mPromptBox->getName() + "/MessageText");
		CEGUI::Window* editbox = mPromptBox->getChild(mPromptBox->getName() + "/Editbox");
		const float32 offset = 10;
		float32 buttonHeight = mPromptBox->getChild(mPromptBox->getName() + "/ButtonOK")->getPixelSize().d_height;
		float32 editboxHeight = editbox->getPixelSize().d_height;
	
		messageText->setText(text);
		float32 textWidth = StringConverter::FromString<float32>(messageText->getProperty("HorzExtent").c_str());
		float32 textHeight = StringConverter::FromString<float32>(messageText->getProperty("VertExtent").c_str());

		editbox->subscribeEvent(CEGUI::Editbox::EventKeyDown, CEGUI::Event::Subscriber(&PromptBox::OnEditboxKeyDown, this));

		messageText->setArea(CEGUI::UDim(0,offset), CEGUI::UDim(0,0), CEGUI::UDim(1, -2.0f*offset), CEGUI::UDim(1, -buttonHeight-editboxHeight - offset));
		mPromptBox->setWidth(CEGUI::UDim(0, textWidth + 2.0f*offset + INNER_FRAME_OFFSET));
		mPromptBox->setHeight(CEGUI::UDim(0, textHeight + buttonHeight + editboxHeight + offset + INNER_FRAME_OFFSET));
		mPromptBox->setXPosition(CEGUI::UDim(0.5f, -0.5f*mPromptBox->getPixelSize().d_width));
		mPromptBox->setYPosition(CEGUI::UDim(0.5f, -0.5f*mPromptBox->getPixelSize().d_height));

		EnsureWindowIsWideEnough();
	}
	OC_CEGUI_CATCH;
}
예제 #17
0
void PlayState::createGUI ()
{
  _renderer = &CEGUI::OgreRenderer::bootstrapSystem();
  CEGUI::Scheme::setDefaultResourceGroup ("Schemes");
  CEGUI::ImageManager::setImagesetDefaultResourceGroup ("Imagesets");
  CEGUI::Font::setDefaultResourceGroup ("Fonts");
  CEGUI::WindowManager::setDefaultResourceGroup ("Layouts");
  CEGUI::WidgetLookManager::setDefaultResourceGroup ("LookNFeel");

  CEGUI::SchemeManager::getSingleton ().createFromFile ("TaharezLook.scheme");
    
  CEGUI::System::getSingleton ().getDefaultGUIContext ().setDefaultFont ("DejaVuSans-12");
  CEGUI::System::getSingleton ().getDefaultGUIContext ().getMouseCursor ().setDefaultImage ("TaharezLook/MouseArrow");
  
  //PARCHEO RATÓN CEGUI: para que al inicio se encuentre en la misma posicion que el raton de OIS
  // Move CEGUI mouse to (0,0)                                        
  CEGUI::Vector2f mousePos = CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().getPosition();
  CEGUI::System::getSingleton().getDefaultGUIContext().injectMouseMove(-mousePos.d_x,-mousePos.d_y);
 
  //Sheet
  CEGUI::Window* sheet = CEGUI::WindowManager::getSingleton ().createWindow ("DefaultWindow","HLF/Sheet");

  //Quit button
  CEGUI::Window* quitButton = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/QuitButton");
  quitButton->setText ("Quit");
  quitButton->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0)));
  quitButton->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.84, 0), CEGUI::UDim (0.01, 0)));
  quitButton->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::quit, this));

  //Attaching buttons
  sheet->addChild (quitButton);
  CEGUI::System::getSingleton().getDefaultGUIContext ().setRootWindow (sheet);
}
예제 #18
0
void PlayState::createGUIDefensaHumano()
{

  if (_jugadores[0]->_num_portaviones < _jugadores[0]->NUM_MAX_PORTAVIONES)
  {          
      CEGUI::Window* btnPortaviones = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/Portaviones");
      btnPortaviones->setText ("Portaviones");
      btnPortaviones->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0)));
      btnPortaviones->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.01, 0), CEGUI::UDim (0.01, 0)));
      btnPortaviones->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::colocaPortaviones, this));
      CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnPortaviones);

  }
  
  if (_jugadores[0]->_num_acorazados < _jugadores[0]->NUM_MAX_ACORAZADOS)
  {
      CEGUI::Window* btnAcorazado = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/Acorazado");
      btnAcorazado->setText ("Acorazado");
      btnAcorazado->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0)));
      btnAcorazado->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.20, 0), CEGUI::UDim (0.01, 0)));
      btnAcorazado->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::colocaAcorazado, this));
      CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnAcorazado);
  }

  if (_jugadores[0]->_num_lanchas < _jugadores[0]->NUM_MAX_LANCHAS)
  {
      CEGUI::Window* btnLancha = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/Lancha");
      btnLancha->setText ("Lancha");
      btnLancha->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0)));
      btnLancha->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.39, 0), CEGUI::UDim (0.01, 0)));
      btnLancha->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::colocaLancha, this));
      CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnLancha);
  }
  
  if ( _jugadores[0]->_num_acorazados + _jugadores[0]->_num_lanchas + _jugadores[0]->_num_portaviones  == 
       _jugadores[0]->NUM_MAX_ACORAZADOS + _jugadores[0]->NUM_MAX_LANCHAS + _jugadores[0]->NUM_MAX_PORTAVIONES)
  {
       addSceneAtaque();
       createGUINext(); 
       createGUIInfo();
       _turnoEnCurso = true;
       _estado = jugando;
  }
  
  
  
}
예제 #19
0
void DrawBase::DrawBlueprint(Logic::SendBlueToGui *evnt){
	
	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
	CEGUI::Window *res;
	Ogre::String name;
	Ogre::String text;
	int x=0,y=0,i=0;
	std::vector<Logic::BuildingBlueprint *>::iterator the_iterator;
	the_iterator = evnt->allBlue.begin();
	
	if(wmgr.isWindowPresent( "Blueprint/sheet")){
		mBlueSheet= wmgr.getWindow( "Blueprint/sheet");
		ClearFromAllChild(mBlueSheet);
		mBlueSheet->addChildWindow(mBlueSheetClose); 

	}else{

		mBlueSheet= wmgr.createWindow("TaharezLook/StaticImage", "Blueprint/sheet");
		mBlueSheet->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.5, 0)));
		mBlueSheet->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5,0), CEGUI::UDim(0, 0)));
		mBlueSheetClose= wmgr.createWindow("TaharezLook/Button",   "Blueprint/close");
		mBlueSheetClose->setPosition(CEGUI::UVector2(CEGUI::UDim(0,0), CEGUI::UDim(0, 0)));
		mBlueSheetClose->setSize(CEGUI::UVector2(CEGUI::UDim(0.3, 0), CEGUI::UDim(0.1, 0)));
		mBlueSheetClose->setText("Close");
		mBlueSheetClose->subscribeEvent(CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber(&BaseDraw::Close,(BaseDraw*) this));
		mBlueSheet->addChildWindow(mBlueSheetClose); 
	}
	while (the_iterator !=  evnt->allBlue.end()) {
		name= "Blueprint/BlueNum"+Logic::LogicStd::IntToString(i++);
		if(wmgr.isWindowPresent(name)){
			res= wmgr.getWindow(name);
			res->setUserData((*the_iterator));
			mBlueSheet->addChildWindow(res);
		}else{
			res= wmgr.createWindow("TaharezLook/Button", name);
			res->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5*x,0), CEGUI::UDim(0.2*y+0.1, 0)));
			res->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.2, 0)));
			res->setUserData((*the_iterator));

			mBlueSheet->addChildWindow(res);
			res->subscribeEvent(CEGUI::PushButton::EventClicked,
				CEGUI::Event::Subscriber(&DrawBase::BuildOrder, this));


		}
		text=(*the_iterator)->mName;
		text+="_"+Logic::LogicStd::IntToString((*the_iterator)->mCost);
		res->setText(text);
		if(++x>=2){
			x=0;
			y++;
		}
		++the_iterator;
	}
	mMainWindow->addChildWindow(mBlueSheet);


}
예제 #20
0
void SelectorHelper::SwitchToPlayerSelectMenu(void) {
  CEGUI::WindowManager *wmgr = CEGUI::WindowManager::getSingletonPtr();

  CEGUI::System::getSingleton().setGUISheet(wmgr->getWindow("Menu/PlayerSelect"));
  CEGUI::Window* penguinButton = wmgr->getWindow("Menu/Penguin");
  CEGUI::Window* ogreButton = wmgr->getWindow("Menu/Ogre");
  CEGUI::Window* ninjaButton = wmgr->getWindow("Menu/Ninja");

  penguinButton->subscribeEvent(CEGUI::PushButton::EventClicked,
                                &SelectorHelper::SelectCharacter);

  ogreButton->subscribeEvent(CEGUI::PushButton::EventClicked,
                             &SelectorHelper::SelectCharacter);

  ninjaButton->subscribeEvent(CEGUI::PushButton::EventClicked,
                              &SelectorHelper::SelectCharacter);
}
예제 #21
0
void GameMenuDemo::setupNaviIconAnimationEventHandlers()
{
    d_botNaviLeftArrowArea->subscribeEvent(CEGUI::Window::EventMouseEntersArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    d_botNaviLeftArrowArea->subscribeEvent(CEGUI::Window::EventMouseLeavesArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    d_botNaviRightArrowArea->subscribeEvent(CEGUI::Window::EventMouseEntersArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    d_botNaviRightArrowArea->subscribeEvent(CEGUI::Window::EventMouseLeavesArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    CEGUI::Window* window;
    window = d_root->getChild("BotNavigationContainer/NaviCenterContainer/NavigationLabel");
    window->subscribeEvent(CEGUI::Window::EventMouseEntersArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    window->subscribeEvent(CEGUI::Window::EventMouseLeavesArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    window = d_root->getChild("BotNavigationContainer/NaviCenterContainer/NavigationIcon");
    window->subscribeEvent(CEGUI::Window::EventMouseEntersArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    window->subscribeEvent(CEGUI::Window::EventMouseLeavesArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    window = d_root->getChild("BotNavigationContainer/NaviCenterContainer/NaviBotSelectionIcon");
    window->subscribeEvent(CEGUI::Window::EventMouseEntersArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
    window->subscribeEvent(CEGUI::Window::EventMouseLeavesArea, Event::Subscriber(&GameMenuDemo::handleCheckIfNaviIconAnimationNeedsChange, this));
}
예제 #22
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;
    }
}
예제 #23
0
void CUIEditorView::setWindowSelected(const CEGUI::String& name,bool addEvent /*= true*/)
{
	try
	{
		if( name.length()> 0 && name != m_nSelectWindowName)
		{
			if(name == "___Shower_Window____") return;
			CEGUI::Window* pWindow = CEGUI::WindowManager::getSingleton().getWindow(name);
			CEGUI::Window* pOldSel = NULL;
			if (pWindow && !pWindow->isAutoWindow())
			{
				if(m_nSelectWindowName.length() > 0)
				{
					pOldSel = CEGUI::WindowManager::getSingleton().getWindow(m_nSelectWindowName);
					if (pOldSel)
					{
						for(;pOldSel && pOldSel != CEGUI::System::getSingleton().getGUISheet(); pOldSel = pOldSel->getParent())
						{
							pOldSel->unsubscribeEvent(CEGUI::Window::EventMoved, CEGUI::Event::Subscriber(&CUIEditorView::handleSelectedWindowMoved, this));
						}
					}
				}
				//pWindow->moveToFront();
				m_nSelectWindowName = pWindow->getName();
				CEGUI::Window* pSet = pWindow;
				for (; pSet&& pSet !=CEGUI::System::getSingleton().getGUISheet(); pSet = pSet->getParent() )
				{
					pSet->subscribeEvent(CEGUI::Window::EventMoved, CEGUI::Event::Subscriber(&CUIEditorView::handleSelectedWindowMoved, this));
				}
				CEGUI::Rect rect = pWindow->getPixelRect();
				setSelectWindowPos(CRect(rect.d_left, rect.d_top, rect.getWidth(), rect.getHeight()));
				m_ptMouseMovePos = CPoint(0,0);			
			}
			m_pSelectedWindow = pWindow;
			updateCurrentWindowStatusText();
			if (addEvent)
			{
				g_DataPool.OnSelectWindowChanged(pOldSel,pWindow);
			}
		}
		else if (name.length() == 0)
		{
			if (addEvent)
			{
				g_DataPool.OnSelectWindowChanged(m_pSelectedWindow,NULL);
			}
			m_nSelectWindowName = "";
			setSelectWindowPos(CRect(), true);
			m_pSelectedWindow = NULL;
		}
	}
	catch(CEGUI::UnknownObjectException& e)
	{
		
	}
}
예제 #24
0
void PlayState::createGUINext()
{

  CEGUI::Window* btnNext = CEGUI::WindowManager::getSingleton ().createWindow ("TaharezLook/Button", "HLF/NextButton");
  btnNext->setText ("NEXT");
  btnNext->setSize (CEGUI::USize (CEGUI::UDim (0.15, 0), CEGUI::UDim (0.05, 0)));
  btnNext->setPosition (CEGUI::UVector2 (CEGUI::UDim (0.01,0), CEGUI::UDim (0.01, 0)));
  btnNext->subscribeEvent (CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber (&PlayState::siguiente, this));
  CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow()->addChild(btnNext);
}
예제 #25
0
void
MenuState::createGUI()
{
  //Limpiar interfaz del estado anterior-------------------
  CEGUI::Window* sheet=CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

  //-------------------------------------------------------
  CEGUI::Window* sheetBG =  CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage","backgroundMenu");
  sheetBG->setPosition(CEGUI::UVector2(cegui_reldim(0),cegui_reldim(0)));
  sheetBG->setSize( CEGUI::USize(cegui_reldim(1),cegui_reldim(1)));
  sheetBG->setProperty("Image","BackgroundImageMenu");
  sheetBG->setProperty("FrameEnabled","False");
  sheetBG->setProperty("BackgroundEnabled", "False");


  CEGUI::ListboxTextItem* itm;


  CEGUI::Listbox* editBox = static_cast<CEGUI::Listbox*> (CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Listbox","listbox"));
  editBox->setSize(CEGUI::USize(CEGUI::UDim(0.6,0),CEGUI::UDim(0.6,0)));
  editBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.20, 0),CEGUI::UDim(0.10, 0)));

  const CEGUI::Image* sel_img = &CEGUI::ImageManager::getSingleton().get("TaharezLook/MultiListSelectionBrush");
  
  std::vector<string> files = listDir("./data/Levels/*"); // ./Para directorio actual ./Carpeta/* para otra carpeta
  for(unsigned int i=0;i<files.size();i++){
    string aux=files[i];
    if(Ogre::StringUtil::endsWith(aux,".txt")){
      cout << "================ File: " << aux <<"================"<< endl;
      _recorridos.push_back(aux);
      string file=Ogre::StringUtil::split(aux,"/")[3];
      cout<<"File: " << file << endl;
      file=Ogre::StringUtil::replaceAll(file,".txt","");
      cout<<"File: " << file << endl;
      itm = new CEGUI::ListboxTextItem(file,0);
      itm->setFont("DickVanDyke-28");
      itm->setTextColours(CEGUI::Colour(0.0,0.8,0.5));
      itm->setSelectionBrushImage(sel_img);
      editBox->addItem(itm);
    }
    
  }
  //---------------------------------------------------

  CEGUI::Window* playButton = CEGUI::WindowManager::getSingleton().createWindow("OgreTray/Button","playButton");
  playButton->setText("[font='DickVanDyke'] Start");
  playButton->setSize(CEGUI::USize(CEGUI::UDim(0.25,0),CEGUI::UDim(0.07,0)));
  playButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.4,0),CEGUI::UDim(0.8,0)));
  playButton->subscribeEvent(CEGUI::PushButton::EventClicked,CEGUI::Event::Subscriber(&MenuState::playB,this));

  sheetBG->addChild(playButton);
  sheetBG->addChild(editBox);
  sheet->addChild(sheetBG);

}
예제 #26
0
파일: PromptBox.cpp 프로젝트: Ocerus/Ocerus
PromptBox::PromptBox(int32 tag): mTag(tag), mPromptBox(0), mMinWidth(0)
{
	CEGUI::String windowName;
	static int i = 0;
	do
	{
		i++;
		windowName = "PromptBox" + StringConverter::ToString(i);
	}
	while (gGUIMgr.WindowExists(windowName.c_str()));
	mPromptBox = gGUIMgr.LoadSystemLayout("PromptBox.layout", windowName);
	mPromptBox->setModalState(true);

	CEGUI::Window* btnOK = mPromptBox->getChild(mPromptBox->getName() + "/ButtonOK");
	btnOK->setID(0);
	btnOK->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUISystem::PromptBox::OnButtonClicked, this));
	CEGUI::Window* btnCancel = mPromptBox->getChild(mPromptBox->getName() + "/ButtonCancel");
	btnCancel->setID(1);
	btnCancel->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&GUISystem::PromptBox::OnButtonClicked, this));
}
예제 #27
0
void MenuState::createScene() {
  CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
  CEGUI::Window *window = wmgr.createWindow("DefaultWindow", "CEGUI/MenuWindow");

  // title logo
  CEGUI::Window *si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "TitlePng");
  si->setSize(CEGUI::UVector2(CEGUI::UDim(0.8, 0), CEGUI::UDim(0.25, 0)));
  si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.1, 0), CEGUI::UDim(0.05, 0)));
  si->setProperty("Image","set:Title image:full_image");
  si->setProperty("FrameEnabled", "False");
  si->setProperty("BackgroundEnabled", "False");
  window->addChildWindow(si);

  // new game button
  CEGUI::Window *new_game = wmgr.createWindow("TaharezLook/Button", "CEGUI/NewGameButton");
  new_game->setText("Start Game");
  new_game->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.15, 0)));
  new_game->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25, 0), CEGUI::UDim(0.34, 0)));
  window->addChildWindow(new_game);

  // how to play button
  CEGUI::Window *instructions = wmgr.createWindow("TaharezLook/Button", "CEGUI/InstructionsButton");
  instructions->setText("How to Play");
  instructions->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.15, 0)));
  instructions->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25, 0), CEGUI::UDim(0.53, 0)));
  window->addChildWindow(instructions);

  // quit button
  CEGUI::Window *quit = wmgr.createWindow("TaharezLook/Button", "CEGUI/QuitButton");
  quit->setText("Exit Game");
  quit->setSize(CEGUI::UVector2(CEGUI::UDim(0.5, 0), CEGUI::UDim(0.15, 0)));
  quit->setPosition(CEGUI::UVector2(CEGUI::UDim(0.25, 0), CEGUI::UDim(0.72, 0)));
  window->addChildWindow(quit);

  CEGUI::System::getSingleton().setGUISheet(window);

  // event calls
  new_game->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::start, this));
  instructions->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::instruction, this));
  quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&MenuState::quit, this));
}
예제 #28
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;
}
예제 #29
0
bool MainGameScreen::Init()
{
    RootWindow = CEGUI::WindowManager::getSingleton().loadWindowLayout("MainGameScreen.layout");

    try
    {
        CEGUI::Window* ExitButton = GUI->getWindowManager()->getWindow("MainGameScreen/ExitButton");
        if (ExitButton != NULL)
        {
            ExitButton->subscribeEvent(CEGUI::PushButton::EventMouseClick, CEGUI::Event::Subscriber(&MainGameScreen::ExitPressed, this));
        }
    }

    catch(CEGUI::Exception &e)
    {
    }
}
예제 #30
0
파일: HUDemo.cpp 프로젝트: scw000000/Engine
CEGUI::Window* HUDDemo::spawnPlate()
{
    CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();

    CEGUI::Window* plateRoot = winMgr.createWindow("DefaultWindow");
    plateRoot->setSize(CEGUI::USize(cegui_absdim(0.0f), cegui_reldim(0.16f)));
    plateRoot->setAspectMode(CEGUI::AM_EXPAND);
    plateRoot->setAspectRatio(1.0f);
    plateRoot->setRiseOnClickEnabled(false);
    plateRoot->setPixelAligned(false);
    plateRoot->subscribeEvent(CEGUI::Window::EventMouseButtonDown, Event::Subscriber(&HUDDemo::handlePlateWindowClicked, this));
    d_rootIngame->addChild(plateRoot);

    CEGUI::Window* plateImgWnd = winMgr.createWindow("Generic/Image", "ImageWindowPlate");
    plateImgWnd->setProperty("Image", s_imageNamePlate);
    plateImgWnd->setSize(CEGUI::USize(cegui_reldim(1.0f), cegui_absdim(0.0f)));
    plateImgWnd->setAspectRatio(3.308f);
    plateImgWnd->setAspectMode(CEGUI::AM_EXPAND);
    plateImgWnd->setVerticalAlignment(CEGUI::VA_BOTTOM);
    plateImgWnd->setMousePassThroughEnabled(true);
    plateImgWnd->setPixelAligned(false);
    plateRoot->addChild(plateImgWnd);

    CEGUI::String image = getRandomGameImage();

    CEGUI::Window* plateTopping = winMgr.createWindow("Generic/Image", "ImageWindowObject");
    plateTopping->setProperty("Image", image);
    plateTopping->setSize(CEGUI::USize(cegui_reldim(0.88f), cegui_absdim(0.0f)));
    plateTopping->setAspectRatio(1.0f);
    plateTopping->setAspectMode(CEGUI::AM_EXPAND);
    plateTopping->setHorizontalAlignment(CEGUI::HA_CENTRE);
    plateTopping->setMousePassThroughEnabled(true);
    plateTopping->setPixelAligned(false);
    plateRoot->addChild(plateTopping);


    int randumNumber = rand() % 10000;
    float posY = randumNumber / 10000.0f;

    plateRoot->setPosition(CEGUI::UVector2(cegui_absdim(0.0f), cegui_reldim(0.1f + 0.6f * posY)));

    return plateRoot;
}