コード例 #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 InitPetSelectWnd(CEGUI::Window* mainPage)
{
	if (!mainPage)
		return;

	CEGUI::Window* wnd;
	char tempText[256];

	for (int i = 0; i < PET_SELECT_WND_CNT; ++i)
	{
		sprintf(tempText, "PetStrengthen/PetSelectWnd/Pet%d/DragContainer", i+1);
		wnd = mainPage->getChildRecursive(tempText);
		if (wnd)
		{
			wnd->setSize(CEGUI::UVector2(cegui_absdim(32 + 0),cegui_absdim(32 + 0)));
			wnd->setPosition(CEGUI::UVector2(cegui_absdim(5),cegui_absdim(5)));
		}

		sprintf(tempText, "PetStrengthen/PetSelectWnd/Pet%d", i+1);
		wnd = mainPage->getChildRecursive(tempText);
		if (wnd)
		{
			wnd->setSize(CEGUI::UVector2(cegui_absdim(32 + 10),cegui_absdim(32 + 10)));
		}
	}
}
コード例 #3
0
ファイル: WidgetDemo.cpp プロジェクト: AjaxWang1989/cegui
void WidgetDemo::initialiseEventLights(CEGUI::Window* container)
{
    CEGUI::WindowManager &winMgr = CEGUI::WindowManager::getSingleton();

    CEGUI::Window* horizontalLayout = winMgr.createWindow("HorizontalLayoutContainer", "EventLightsContainer");
    horizontalLayout->setPosition(CEGUI::UVector2(cegui_reldim(0.085f), cegui_reldim(0.93f)));
    container->addChild(horizontalLayout);


    d_windowLightUpdatedEvent = winMgr.createWindow("SampleBrowserSkin/Light");
    horizontalLayout->addChild(d_windowLightUpdatedEvent);
    d_windowLightUpdatedEvent->setSize(CEGUI::USize(cegui_reldim(0.0f), cegui_reldim(0.04f)));
    d_windowLightUpdatedEvent->setAspectMode(CEGUI::AM_EXPAND);
    d_windowLightUpdatedEvent->setProperty("LightColour", "FF66FF66");

    CEGUI::Window* updateEventLabel = winMgr.createWindow("Vanilla/Label");
    horizontalLayout->addChild(updateEventLabel);
    updateEventLabel->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.04f)));
    updateEventLabel->setText("EventUpdated");
    updateEventLabel->setFont("DejaVuSans-12-NoScale");
    updateEventLabel->setProperty("HorzFormatting", "LeftAligned");

    d_windowLightMouseMoveEvent = winMgr.createWindow("SampleBrowserSkin/Light");
    horizontalLayout->addChild(d_windowLightMouseMoveEvent);
    d_windowLightMouseMoveEvent->setSize(CEGUI::USize(cegui_reldim(0.0f), cegui_reldim(0.04f)));
    d_windowLightMouseMoveEvent->setAspectMode(CEGUI::AM_EXPAND);
    d_windowLightMouseMoveEvent->setProperty("LightColour", "FF77BBFF");

    CEGUI::Window* mouseMoveEventLabel = winMgr.createWindow("Vanilla/Label");
    horizontalLayout->addChild(mouseMoveEventLabel);
    mouseMoveEventLabel->setSize(CEGUI::USize(cegui_reldim(0.25f), cegui_reldim(0.04f)));
    mouseMoveEventLabel->setText("EventMouseMove");
    mouseMoveEventLabel->setFont("DejaVuSans-12-NoScale");
    mouseMoveEventLabel->setProperty("HorzFormatting", "LeftAligned");
}
コード例 #4
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);
}
コード例 #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
ファイル: MenuState.cpp プロジェクト: RubenCardos/CrackShot
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);

}
コード例 #7
0
ファイル: EditBoxExit.hpp プロジェクト: ChWick/Mencus
  CEditBoxExit(int id,
	       CEGUI::Window *pParent,
	       float fButtonSize,
	       const CEGUI::String &sTitle,
	       CExit &exit) 
    : CEditBoxBase(id, pParent, fButtonSize, sTitle),
      m_Exit(exit),
      m_BackupExit(exit) {

    using namespace CEGUI;
    Combobox *pComboBox = dynamic_cast<Combobox*>(m_pWindow->createChild("OgreTray/Combobox", "ExitSelect"));
    m_pCombobox = pComboBox;
    pComboBox->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
    pComboBox->setSize(USize(UDim(1, 0), UDim(0, 3 * fButtonSize)));
    pComboBox->addItem(new ListboxTextItem("Region"));
    pComboBox->addItem(new ListboxTextItem("Enemy death"));
    pComboBox->setAutoSizeListHeightToContent(true);
    pComboBox->setReadOnly(true);
    pComboBox->subscribeEvent(Combobox::EventListSelectionAccepted,
			      Event::Subscriber(&CEditBoxExit::onListSelectionChanged, this));

    // id
    m_pContentId = m_pWindow->createChild("DefaultWindow", "id");
    m_pContentId->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
    m_pContentId->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));

    Window *pLabel = m_pContentId->createChild("OgreTray/Label", "Exitidlabel");
    pLabel->setPosition(UVector2(UDim(0, 0), UDim(0, 0)));
    pLabel->setSize(USize(UDim(0, fButtonSize), UDim(0, fButtonSize)));
    pLabel->setText("id");

    Window *pEditBox = m_pContentId->createChild("OgreTray/Editbox", "Exitid");
    pEditBox->setPosition(UVector2(UDim(0, fButtonSize), UDim(0, 0)));
    pEditBox->setSize(USize(UDim(1, -fButtonSize), UDim(0, fButtonSize)));
    pEditBox->setText(m_Exit.getID());
    
    m_pContentId->setVisible(m_Exit.getExitType() == EXIT_ENEMY_DEATH);

    // region
    m_pContentRegion = m_pWindow->createChild("DefaultWindow", "region");
    m_pContentRegion->setPosition(UVector2(UDim(0, 0), UDim(0, fButtonSize)));
    m_pContentRegion->setSize(USize(UDim(1, 0), UDim(0, 2 * fButtonSize)));

    createVector(m_pContentRegion, "pos", m_Exit.getBoundingBox().getPosition().x, m_Exit.getBoundingBox().getPosition().y, fButtonSize, 0);
    createVector(m_pContentRegion, "size", m_Exit.getBoundingBox().getSize().x, m_Exit.getBoundingBox().getSize().y, fButtonSize, fButtonSize);

    m_pContentRegion->setVisible(m_Exit.getExitType() == EXIT_REGION);
    

    // default selected exit type
    m_pCombobox->setItemSelectState(m_Exit.getExitType(), true);
  }
コード例 #8
0
ファイル: GUIManager.cpp プロジェクト: scw000000/Engine
// CEGUI::UDim( scale, pos ) : scale : relative point on the screen between (0,1)
//                             pos   : additional absolute shift in pixels
// UDim( 0.5, 100 ) -> middle point + shift 100
CEGUI::Window* GUIManager::CreateCEGUIWindow( const std::string &type, const std::string& name, const Vec4& position, const Vec4& size )
   {
   CEGUI::Window* pWindow = CEGUI::WindowManager::getSingleton( ).createWindow( type, name );
   pWindow->setPosition( CEGUI::UVector2( CEGUI::UDim( position.x, position.y ), CEGUI::UDim( position.z, position.w ) ) );
   pWindow->setSize( CEGUI::USize( CEGUI::UDim( size.x, size.y ), CEGUI::UDim( size.z, size.w ) ) );
   return pWindow;
   }
コード例 #9
0
ファイル: IntroState.cpp プロジェクト: RubenCardos/CrackShot
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 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);
}
コード例 #11
0
ファイル: WidgetDemo.cpp プロジェクト: AjaxWang1989/cegui
void WidgetDemo::initialiseSkinCombobox(CEGUI::Window* container)
{
    WindowManager& winMgr = WindowManager::getSingleton();

    CEGUI::Window* skinSelectionComboboxLabel = winMgr.createWindow("Vanilla/Label", "SkinSelectionComboboxLabel");
    skinSelectionComboboxLabel->setText("Select a Skin and a Widget");
    skinSelectionComboboxLabel->setPosition(CEGUI::UVector2(cegui_reldim(0.65f), cegui_reldim(0.12f)));
    skinSelectionComboboxLabel->setSize(CEGUI::USize(cegui_reldim(0.24f), cegui_reldim(0.07f)));

    d_skinSelectionCombobox = static_cast<CEGUI::Combobox*>(winMgr.createWindow("Vanilla/Combobox", "SkinSelectionCombobox"));
    d_skinSelectionCombobox->setPosition(CEGUI::UVector2(cegui_reldim(0.65f), cegui_reldim(0.2f)));
    d_skinSelectionCombobox->setSize(CEGUI::USize(cegui_reldim(0.24f), cegui_reldim(0.3f)));
    d_skinSelectionCombobox->setReadOnly(true);
    d_skinSelectionCombobox->setSortingEnabled(false);

    d_skinSelectionCombobox->subscribeEvent(CEGUI::Combobox::EventListSelectionAccepted, Event::Subscriber(&WidgetDemo::handleSkinSelectionAccepted, this));

    std::map<CEGUI::String, WidgetListType>::iterator iter = d_skinListItemsMap.begin();
    while(iter != d_skinListItemsMap.end())
    {
        d_skinSelectionCombobox->addItem(new MyListItem(iter->first));

        ++iter;
    }

    container->addChild(d_skinSelectionCombobox);
    container->addChild(skinSelectionComboboxLabel);
}
コード例 #12
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);
}
コード例 #13
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;
  }
  
  
  
}
コード例 #14
0
ファイル: DrawBase.cpp プロジェクト: JazzyJohn/ProtoSpaceGame
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);


}
コード例 #15
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;
}
コード例 #16
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);
}
コード例 #17
0
ファイル: DataPool.cpp プロジェクト: jjiezheng/pap_full
//通知创建一个新窗口
BOOL CDataPool::OnCreateNewWindow(CEGUI::Window* pWinParent)
{
	CEGUI::Window* pWindow = NULL;
	if (m_szCreateWindowType.IsEmpty())
	{
		g_pEditorView->setCreateWindowFlag(false);
		g_pEditorView->setCreateWindow(NULL);
		return FALSE;
	}

	////显示名字对话框
	//CCreateWindowDlg dlg(pWinParent == NULL);
	//if (dlg.DoModal() == IDCANCEL)
	//{
	//	return FALSE;
	//}


	//CString name ;
	//name = dlg.m_szDefaultName;

	//if (name.IsEmpty())
	//{
	//	g_pEditorView->setCreateWindowFlag(false);
	//	g_pEditorView->setCreateWindow(NULL);
	//	return FALSE;
	//}

	//创建窗口
	try
	{
		pWindow = WindowManager::getSingleton().createWindow(m_szCreateWindowType.GetString()/*, name.GetString()*/);
		pWindow->setClippedByParent(true);
		//pWindow->setPosition(CEGUI::Absolute, Point(0,0));
		pWindow->setSize(CEGUI::Absolute, Size(100,100));
		if (pWinParent == NULL)
		{
			System::getSingleton().getGUISheet()->addChildWindow(pWindow);
			g_leftTreeWindow->InsertItemToTree(pWindow->getName().c_str(), NULL);
		}
		else
		{
			pWinParent->addChildWindow(pWindow);
			CString szParentPath = GetParentTreePath(pWindow);
			g_leftTreeWindow->InsertItemToTree(pWindow->getName().c_str(), szParentPath);
		}
		g_pEditorView->setCreateWindow(pWindow);
		return TRUE;
	}
	catch (...)
	{
		MessageBox(AfxGetMainWnd()->GetSafeHwnd(), "创建窗口出现未知错误", "提示", MB_OK);
	}
	return FALSE;
}
コード例 #18
0
EntityIconSlot* EntityIconManager::createSlot(unsigned int pixelSize)
{
	std::stringstream ss;
	ss << "entityIconSlot" << mSlotsCounter++;
	//Make the slot more visible.
	CEGUI::Window* container = mGuiManager.createWindow("EmberLook/StaticImage", ss.str());
	container->setSize(CEGUI::USize(CEGUI::UDim(0, pixelSize), CEGUI::UDim(0, pixelSize)));
	EntityIconSlot* slot = new EntityIconSlot(container);
	mSlots.push_back(slot);
	return slot;
}
コード例 #19
0
ファイル: MenuState.cpp プロジェクト: klt592/GTFinal
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));
}
コード例 #20
0
ファイル: McsHudGui.cpp プロジェクト: 1am3r/cubicplanets
void McsHudGui::init()
{
    CEGUI::MouseCursor::getSingleton().hide();

    CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
    CEGUI::Window *sheet = wmgr.createWindow("DefaultWindow", "MCSHudDefault/DefaultHud");

    CEGUI::Window *crosshair = wmgr.createWindow("Vanilla/StaticImage", "MCSHud/Crosshair");
    crosshair->setProperty("Image", "set:HudImages image:cross");
    crosshair->setSize(CEGUI::UVector2(CEGUI::UDim(0, 32), CEGUI::UDim(0, 32)));
    crosshair->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, -16), CEGUI::UDim(0.5f, -16)));
    crosshair->setProperty("BackgroundEnabled", "False");
    crosshair->setProperty("FrameEnabled", "False");

    mFpsText = wmgr.createWindow("Vanilla/StaticText", "MCSHud/FpsText");
    mFpsText->setAlpha(0.6f);
    mFpsText->setText("");
    mFpsText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 5), CEGUI::UDim(0.0f, 5)));
    mFpsText->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.04f, 0)));
    mFpsText->setProperty("BackgroundEnabled", "False");
    mFpsText->setProperty("FrameEnabled", "False");

    mPosText = wmgr.createWindow("Vanilla/StaticText", "MCSHud/PosText");
    mPosText->setAlpha(0.6f);
    mPosText->setText("");
    mPosText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 5), CEGUI::UDim(0.04f, 5)));
    mPosText->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, 0), CEGUI::UDim(0.04f, 0)));
    mPosText->setProperty("BackgroundEnabled", "False");
    mPosText->setProperty("FrameEnabled", "False");

    mHitPosText = wmgr.createWindow("Vanilla/StaticText", "MCSHud/HitPosText");
    mHitPosText->setAlpha(0.6f);
    mHitPosText->setText("");
    mHitPosText->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 5), CEGUI::UDim(0.08f, 5)));
    mHitPosText->setSize(CEGUI::UVector2(CEGUI::UDim(0.4f, -5), CEGUI::UDim(0.04f, 0)));
    mHitPosText->setProperty("BackgroundEnabled", "False");
    mHitPosText->setProperty("FrameEnabled", "False");

    addFrameGraph(sheet);

    sheet->addChildWindow(crosshair);
    sheet->addChildWindow(mFpsText);
    sheet->addChildWindow(mPosText);
    sheet->addChildWindow(mHitPosText);
    CEGUI::System::getSingleton().setGUISheet(sheet);
}
コード例 #21
0
ファイル: GUIHeartsDisplay.cpp プロジェクト: ChWick/Zelda
CGUIHeartsDisplay::CGUIHeartsDisplay(CEntity *pParentEntity, CEGUI::Window *pParentWindow, const CEGUI::UVector2 &vPosition)
  : CGUIOverlay("gui_hearts_display", pParentEntity, pParentWindow, pParentWindow->createChild("DefaultWindow")),
    m_MaximalHitpoints(0),
    m_CurrentHitpoints(0) {

  m_pRoot->setPosition(vPosition);
  m_pRoot->setSize(USize(UDim(0, 10 * GUI_HEART_IMG_WITH_BORDER_SIZE), UDim(0, 2 * GUI_HEART_IMG_WITH_BORDER_SIZE)));

  for (Ogre::uint16 i = 0; i < m_uiMaxHeartCount; i++) {
		CEGUI::Window *pWindow = m_pRoot->createChild("OgreTray/StaticImage", "heart_" + CEGUI::PropertyHelper<int>::toString(i) );
		pWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(0, (i % (m_uiMaxHeartCount / 2)) * GUI_HEART_IMG_WITH_BORDER_SIZE),CEGUI::UDim(0, (i / (m_uiMaxHeartCount / 2))* GUI_HEART_IMG_WITH_BORDER_SIZE)));
		pWindow->setSize(CEGUI::USize(CEGUI::UDim(0, GUI_HEART_IMG_SIZE),CEGUI::UDim(0, GUI_HEART_IMG_SIZE)));
		pWindow->setProperty("Image","hud/0/4");
		pWindow->setProperty("FrameEnabled","False");
		pWindow->setProperty("BackgroundEnabled","False");
		pWindow->setVisible(false);
	}
}
コード例 #22
0
ファイル: GUI.cpp プロジェクト: alienjon/Escape-
void GUI::initialize()
{
	// Bootstrap the system.
	CEGUI::OpenGLRenderer::bootstrapSystem();

	// Load the resource groups.
	initializeResourceGroups();

	// Load information.
	CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
	CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

	// Create and set the root window.
	CEGUI::Window* root = CEGUI::WindowManager::getSingleton().createWindow("DefaultWindow", "_RootWindow");
	root->setSize(CEGUI::UVector2(CEGUI::UDim(1.f, 0), CEGUI::UDim(1.f, 0)));
	root->setPosition(CEGUI::UVector2(CEGUI::UDim(0.f, 0), CEGUI::UDim(0.f, 0)));
	CEGUI::System::getSingleton().setGUISheet(root);
}
コード例 #23
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));
}
コード例 #24
0
/*************************************************************************
    Creates a label that contains a description of what is seen in the sample
*************************************************************************/
void CustomShapesDrawingSample::createDescriptionLabel()
{
    WindowManager& winMgr = WindowManager::getSingleton();

    // We create a button and subscribe to its click events
    CEGUI::Window* descriptionLabel = winMgr.createWindow("Generic/Label");
    descriptionLabel->setSize(CEGUI::USize(cegui_reldim(0.8f), cegui_reldim(0.25f)));
    descriptionLabel->setHorizontalAlignment(HA_CENTRE);
    descriptionLabel->setProperty("HorzFormatting", "WordWrapCentreAligned");
    descriptionLabel->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_absdim(400.0f)));
    d_root->addChild(descriptionLabel);
    descriptionLabel->setText("The left graph is rendered directly into a GeometryBuffer and rendered as overlay."
                              "The right graph is created using an SVGImage with modified SVGData and is then used in the same way as a regular CEGUI image"
                              " - it is set as a property for a window that renders the image. \n\n"
                              "The benefit of creating custom geometry by using an SVGImage and its SVGData is that it can be conveniently added to a CEGUI Window "
                              "and that defining primitive objects, such as lines, rectangles etc., is easier. Additionally, the internal CEGUI SVG classes which "
                              "create the geometry offer an anti-aliasing option that delivers anti-aliasing at almost no extra performance cost for the GPU.");
}
コード例 #25
0
ファイル: McsHudGui.cpp プロジェクト: 1am3r/cubicplanets
void McsHudGui::addFrameGraph(CEGUI::Window* sheet)
{
    Ogre::TexturePtr tex = mOgreRoot->getTextureManager()->createManual(
                               "FrameGraph", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
                               TimeGraphMaxFrames, TimeGraphMaxResolution, 0, Ogre::PF_R8G8B8, Ogre::TU_RENDERTARGET);

    Ogre::SceneManager* debugSceneMgr = mOgreRoot->createSceneManager(Ogre::ST_GENERIC);
    debugSceneMgr->setAmbientLight(Ogre::ColourValue(1.0f, 1.0f, 1.0f));

    Ogre::MaterialPtr frameLinesMaterial = Ogre::MaterialManager::getSingleton().create("frameLinesMaterial","Game");
    frameLinesMaterial->setReceiveShadows(false);
    frameLinesMaterial->getTechnique(0)->setLightingEnabled(false);
    frameLinesMaterial->getTechnique(0)->getPass(0)->setDepthCheckEnabled(false);
    frameLinesMaterial->getTechnique(0)->getPass(0)->setDepthWriteEnabled(false);

    mFrameLines = new FrameGraphRenderable(TimeGraphMaxFrames, TimeGraphMaxResolution);
    mFrameLines->setMaterial("frameLinesMaterial");

    Ogre::SceneNode* frameLinesNode = debugSceneMgr->getRootSceneNode()->createChildSceneNode("frameGraph_node");
    frameLinesNode->attachObject(mFrameLines);
    Ogre::Camera* dbg_camera = debugSceneMgr->createCamera("item_camera");
    dbg_camera->setAspectRatio(static_cast<Ogre::Real>(TimeGraphMaxFrames) / static_cast<Ogre::Real>(TimeGraphMaxResolution));
    Ogre::Viewport *v = tex->getBuffer()->getRenderTarget()->addViewport(dbg_camera);
    v->setClearEveryFrame( true );
    v->setBackgroundColour( Ogre::ColourValue::Black );



    CEGUI::Texture& guiTex = mCeRenderer->createTexture(tex);
    CEGUI::Imageset& imageSet = CEGUI::ImagesetManager::getSingleton().create("FrameGraphImageset", guiTex);
    imageSet.defineImage("FrameGraphImage", CEGUI::Point(0.0f, 0.0f), CEGUI::Size(guiTex.getSize()), CEGUI::Point(0.0f, 0.0f));
    CEGUI::Window* si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "FrameGraphWindow");
    si->setSize(CEGUI::UVector2(CEGUI::UDim(0.0f, TimeGraphMaxFrames), CEGUI::UDim(0.0f, TimeGraphMaxResolution)));
    si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 0), CEGUI::UDim(1.0f, -TimeGraphMaxResolution)));
    si->setProperty("Image", CEGUI::PropertyHelper::imageToString(&imageSet.getImage("FrameGraphImage")));
    si->setAlpha(0.6f);
    si->setProperty("BackgroundEnabled", "False");
    si->setProperty("FrameEnabled", "False");

    sheet->addChildWindow(si);
}
コード例 #26
0
ファイル: Gui.cpp プロジェクト: agudpp/CordobaZombie
void Gui::cargarImagen(const string &imagen, const string &nombre)
{
	CEGUI::Window *myImageWindow = CEGUI::WindowManager::getSingleton().createWindow("Menu/StaticImage", nombre);
	wMgrPtr->getWindow("Root")->addChildWindow(myImageWindow);
	myImageWindow->setPosition(CEGUI::UVector2( CEGUI::UDim( 0, 0 ), CEGUI::UDim( 0, 0 ) ) );

	cout<<"h " << h << endl;
	float proporcion = (float)h / 1920;
	cout<<"proporcion " << proporcion << endl;
	int ancho = 944*proporcion;
	cout<<"ancho " << ancho << endl;

	myImageWindow->setSize(CEGUI::UVector2(CEGUI::UDim(0,ancho),CEGUI::UDim(1,0)));
	myImageWindow->setProperty("Image",imagen);
	myImageWindow->setProperty("BackgroundEnabled", "true");
	myImageWindow->setProperty("FrameEnabled", "False");
	myImageWindow->setText("Prueba de texto dentro de la ventana");
	myImageWindow->setTooltipText("Texto de la imagen");
	myImageWindow->setAlpha(1.0);

}
コード例 #27
0
ファイル: testaarhud.cpp プロジェクト: VRAC-WATCH/deltajug
CEGUI::Window* TestAARHUD::CreateText(const std::string& name, CEGUI::Window* parent, const std::string& text,
                                 float x, float y, float width, float height)
{
   CEGUI::WindowManager* wm = CEGUI::WindowManager::getSingletonPtr();

   // create base window and set our default attribs
   CEGUI::Window* result = wm->createWindow("WindowsLook/StaticText", name);
   parent->addChildWindow(result);
   result->setText(text);
   result->setPosition(CEGUI::UVector2(cegui_absdim(x), cegui_absdim(y)));
   result->setSize(CEGUI::UVector2(cegui_absdim(width), cegui_absdim(height)));
   result->setProperty("FrameEnabled", "false");
   result->setProperty("BackgroundEnabled", "false");
   result->setHorizontalAlignment(CEGUI::HA_LEFT);
   result->setVerticalAlignment(CEGUI::VA_TOP);
   // set default color to white
   result->setProperty("TextColours", 
      CEGUI::PropertyHelper::colourToString(CEGUI::colour(1.0f, 1.0f, 1.0f)));
   result->show();

   return result;
}
コード例 #28
0
ファイル: UIEditorView.cpp プロジェクト: gitrider/wxsj2
//只改变大小,不改变位置
void CUIEditorView::sizingWindow(CPoint point,INT type,CEGUI::Window* pWin/* = NULL*/)
{
	CEGUI::Window* pWindow =  pWin ? pWin : m_pSelectedWindow;
	if (pWindow)
	{
		CEGUI::Window* pParent = pWindow;
		CEGUI::Size pt(0,0);
		if (pWindow->getParent() == CEGUI::System::getSingleton().getGUISheet())
		{
			CEGUI::Point pos = pWindow->getPixelRect().getPosition();
			pt = CEGUI::Size(point.x - pos.d_x, point.y - pos.d_y);
		}
		else
		{
			while (pParent && pParent->getParent() != CEGUI::System::getSingleton().getGUISheet())
			{
				pParent = pParent->getParent();
			}
			CEGUI::Rect	 rectWindow = pWindow->getPixelRect();
			pt = CEGUI::Size(point.x -rectWindow.getPosition().d_x   ,point.y -rectWindow.getPosition().d_y);
		}
		pWindow->setClippedByParent(true);
		if(type == 0)
		{
			pWindow->setHeight(CEGUI::Absolute,pt.d_height);
		}
		else if (type == 1)
		{
			pWindow->setWidth(CEGUI::Absolute,pt.d_width);
		}
		else
		{
			pWindow->setSize(CEGUI::Absolute, pt);
		}
	}
}
コード例 #29
0
void DrawMilitary::DoDraw(Logic::ShowMilitary *evnt){
	if(!isOpen&&evnt->isReSend){
		return;
	}
		if(evnt->isReSend&& PriorIdDraw){
		return;
	}
	
	isOpen =true;
	mIsResend = false;
	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();

	CEGUI::Window *res;
	CEGUI::ProgressBar *prog;
	Ogre::String name ="MilitarySheet/";
	Ogre::String text;
	mBuilding = evnt->target;
	if(wmgr.isWindowPresent("MilitarySheet")){
		if(!evnt->isReSend){
			ClearFromAllChild(mFrameWindow);
		}
	
		prog= static_cast<CEGUI::ProgressBar *>(wmgr.getWindow("MilitarySheet/Progress"));
		if(!evnt->isReSend){
				mFrameWindow->addChildWindow(mCloseBtn); 
				mFrameWindow->addChildWindow(prog); 	
		}
	}else{
		mFrameWindow= wmgr.createWindow("TaharezLook/StaticImage",  "MilitarySheet");
		mFrameWindow->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));
		mCloseBtn= wmgr.createWindow("TaharezLook/Button",  "MilitarySheet/Close");
		mCloseBtn->setPosition(CEGUI::UVector2(CEGUI::UDim(0,0), CEGUI::UDim(0, 0)));
		mCloseBtn->setSize(CEGUI::UVector2(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0)));
		mCloseBtn->setText("Close");
		mCloseBtn->subscribeEvent(CEGUI::PushButton::EventClicked,
			CEGUI::Event::Subscriber(&BaseDraw::Close,(BaseDraw*) this));
		prog=  static_cast<CEGUI::ProgressBar *>(wmgr.createWindow("TaharezLook/ProgressBar", "MilitarySheet/Progress"));
		prog->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2,0), CEGUI::UDim(0, 0)));
		prog->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.05, 0)));
		mFrameWindow->addChildWindow(mCloseBtn);
		mFrameWindow->addChildWindow(prog); 	
	}
	prog->setProgress(evnt->procent);

	int i=0;
	while(i<5&&!(evnt->unitQueue.empty())){
			name="MilitarySheet/quere"+Logic::LogicStd::IntToString(i);
			if(wmgr.isWindowPresent(name)){
				res= wmgr.getWindow(name);
				if(!evnt->isReSend){
				mFrameWindow->addChildWindow(res);
				}
			}else{
				res= wmgr.createWindow("TaharezLook/StaticText", name);
				res->setPosition(CEGUI::UVector2(CEGUI::UDim(0.1*i,0), CEGUI::UDim(0.05, 0)));
				res->setSize(CEGUI::UVector2(CEGUI::UDim(0.1, 0), CEGUI::UDim(0.1, 0)));
				mFrameWindow->addChildWindow(res);		
			}
			res->setText(evnt->unitQueue.front());
			evnt->unitQueue.pop();
			i++;
	}
	i=0;
	std::map<Ogre::String,Logic::BaseUnitBlueprint*>::iterator iterAvUn;
	for(iterAvUn = evnt->avaibleUnits.begin();iterAvUn!=evnt->avaibleUnits.end();++iterAvUn){
		name="MilitarySheet/availebtobuild"+Logic::LogicStd::IntToString(i);
			if(wmgr.isWindowPresent(name)){
				res= wmgr.getWindow(name);
				if(!evnt->isReSend){
				mFrameWindow->addChildWindow(res);
				}
			}else{
				res= wmgr.createWindow("TaharezLook/Button", name);
				res->setPosition(CEGUI::UVector2(CEGUI::UDim(0.9,0), CEGUI::UDim(0.1*i+0.05, 0)));
				res->setSize(CEGUI::UVector2(CEGUI::UDim(0.1, 0), CEGUI::UDim(0.1, 0)));
					res->subscribeEvent(CEGUI::PushButton::EventClicked,
						CEGUI::Event::Subscriber(&DrawMilitary::AddUnitToQueue, this));
				mFrameWindow->addChildWindow(res);		
			}
			res->setUserData(iterAvUn->second);
			res->setText(iterAvUn->first);
		
	}
	i=0;
	std::vector<Logic::UnitToSend>::iterator iterUnOnBase;
	int x=0,y=0;
	for(iterUnOnBase = evnt->unitOnBase.begin();iterUnOnBase!=evnt->unitOnBase.end();++iterUnOnBase){
		name="MilitarySheet/onBase"+Logic::LogicStd::IntToString(i);
			if(wmgr.isWindowPresent(name)){
			res= wmgr.getWindow(name);
			if(!evnt->isReSend){
			mFrameWindow->addChildWindow(res);
			}
		}else{
			res= wmgr.createWindow("TaharezLook/Button", name);
			res->setPosition(CEGUI::UVector2(CEGUI::UDim(0.15*x,0), CEGUI::UDim(0.05*(y+1)+0.5, 0)));
			res->setSize(CEGUI::UVector2(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0)));
			mFrameWindow->addChildWindow(res);
			res->subscribeEvent(CEGUI::PushButton::EventClicked,
						CEGUI::Event::Subscriber(&DrawMilitary::UnitClick, this));
		
		


		}
			res->setText(iterUnOnBase->name);
			res->setUserData(iterUnOnBase->unit);
		if(++x>3){
			y++;
			x=0;
		}
		i++;
	}
	if(!evnt->isReSend){
	mMainWindow->addChildWindow(mFrameWindow);
	PriorIdDraw= true;
	}else{
	PriorIdDraw= false;
	}
}
コード例 #30
0
ファイル: Menu.cpp プロジェクト: Pespo/Little-Lead-Marble
llm::Menu::Menu() {
	m_pSceneManager = llm::Application::getInstance()->root()->createSceneManager( "DefaultSceneManager", "Menu" );
	m_pCamera = m_pSceneManager->createCamera( "Camera" );
	m_pCamera->setNearClipDistance(5);

	 ///---------initialisation CEGUI -----------
    CEGUI::OgreRenderer::bootstrapSystem();

    //Chargement des ressources
	Ogre::ResourceGroupManager& rgm = Ogre::ResourceGroupManager::getSingleton();

	rgm.createResourceGroup("imagesets");
	rgm.createResourceGroup("fonts");
	rgm.createResourceGroup("layouts");
	rgm.createResourceGroup("schemes");
	rgm.createResourceGroup("looknfeels");

	rgm.addResourceLocation( "../res/CEGUI/schemes/", "FileSystem", "Schemes");
	rgm.addResourceLocation( "../res/CEGUI/imagesets/", "FileSystem", "Imagesets");
	rgm.addResourceLocation( "../res/CEGUI/fonts/", "FileSystem", "Fonts");
	rgm.addResourceLocation( "../res/CEGUI/layouts/", "FileSystem", "Layouts");
	rgm.addResourceLocation( "../res/CEGUI/looknfeel/", "FileSystem", "LookNFeel");
 
	rgm.initialiseAllResourceGroups();
	
 	//Linkage des ressources avec CEGUI
    CEGUI::Imageset::setDefaultResourceGroup("Imagesets");
	CEGUI::Font::setDefaultResourceGroup("Fonts");
	CEGUI::Scheme::setDefaultResourceGroup("Schemes");
	CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
	CEGUI::WindowManager::setDefaultResourceGroup("Layouts");

	//Définition
	CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
	CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");
	CEGUI::MouseCursor::getSingleton().setImage( CEGUI::System::getSingleton().getDefaultMouseCursor());
    CEGUI::ImagesetManager::getSingleton().createFromImageFile("BackgroundImage","MenuBackground.tga");

	CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
	llm::Application* app = llm::Application::getInstance();

	/******* Menu ********/
	CEGUI::Window *Menu = wmgr.createWindow("DefaultWindow", "Menu"); //conteneur
	CEGUI::System::getSingleton().setGUISheet(Menu);//Linkage du conteneur a CEGUI

	/******StartMenu*****/
	CEGUI::Window *startMenu = wmgr.createWindow("TaharezLook/StaticImage", "StartMenu/Sheet"); //conteneur
	startMenu->setPosition( CEGUI::UVector2( CEGUI::UDim( 0, 0 ), CEGUI::UDim( 0, 0 ) ) );
    startMenu->setSize(CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0)));  
    startMenu->setProperty( "Image", "set:BackgroundImage image:full_image" );
    Menu->addChildWindow(startMenu);
	
	CEGUI::Window *options = wmgr.createWindow("TaharezLook/OptionsButton", "StartMenu/OptionsButton");
    //quit->setText("Options");
    options->setPosition(CEGUI::UVector2( CEGUI::UDim( 0.2f, 0 ), CEGUI::UDim( 0.8f, 0 ) ) );
    options->setSize(CEGUI::UVector2(CEGUI::UDim(0.18, 0), CEGUI::UDim(0.16, 0)));
    startMenu->addChildWindow(options);//intégration du bouton dans le conteneur	

	CEGUI::Window *start = wmgr.createWindow("TaharezLook/PlayButton", "StartMenu/StartButton"); //bouton
	//start->setText("Start");
	start->setPosition(CEGUI::UVector2( CEGUI::UDim( 0.4f, 0 ), CEGUI::UDim( 0.75f, 0 ) ) );
    start->setSize(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.19f, 0)));
    startMenu->addChildWindow(start);//intégration du bouton dans le conteneur

	CEGUI::Window *quitStart = wmgr.createWindow("TaharezLook/QuitButton", "StartMenu/QuitButton"); //bouton
    //quit->setText("Quit");
    quitStart->setPosition(CEGUI::UVector2( CEGUI::UDim( 0.62f, 0 ), CEGUI::UDim( 0.8f, 0 ) ) );
    quitStart->setSize(CEGUI::UVector2(CEGUI::UDim(0.18, 0), CEGUI::UDim(0.16, 0)));
    startMenu->addChildWindow(quitStart);//intégration du bouton dans le conteneur

	wmgr.getWindow("StartMenu/StartButton")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&llm::Application::startGame, app));//event du bouton
	wmgr.getWindow("StartMenu/QuitButton")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&llm::Application::quit, app));//event du bouton

	/******PauseMenu*****/
	CEGUI::Window *PauseMenu = wmgr.createWindow("DefaultWindow", "PauseMenu/Sheet"); //conteneur
	Menu->addChildWindow(PauseMenu);

	CEGUI::Window *continued = wmgr.createWindow("TaharezLook/Button", "PauseMenu/ContinueButton"); //bouton
	continued->setText("Continue");
	continued->setPosition(CEGUI::UVector2( CEGUI::UDim( 0.42f, 0 ), CEGUI::UDim( 0.40f, 0 ) ) );
	continued->setSize(CEGUI::UVector2(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0)));
	PauseMenu->addChildWindow(continued);//intégration du bouton dans le conteneur

	CEGUI::Window *reset = wmgr.createWindow("TaharezLook/Button", "PauseMenu/ResetButton"); //bouton
	reset->setText("Reset");
	reset->setPosition(CEGUI::UVector2( CEGUI::UDim( 0.42f, 0 ), CEGUI::UDim( 0.50f, 0 ) ) );
	reset->setSize(CEGUI::UVector2(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0)));
	PauseMenu->addChildWindow(reset);//intégration du bouton dans le conteneur

	CEGUI::Window *quitPause = wmgr.createWindow("TaharezLook/Button", "PauseMenu/QuitButton"); //bouton
	quitPause->setText("Quit");
	quitPause->setPosition(CEGUI::UVector2( CEGUI::UDim( 0.42f, 0 ), CEGUI::UDim( 0.60f, 0 ) ) );
	quitPause->setSize(CEGUI::UVector2(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0)));
	PauseMenu->addChildWindow(quitPause);//intégration du bouton dans le conteneur
	
	wmgr.getWindow("PauseMenu/ContinueButton")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&llm::Application::pause, app));//event du bouton
	wmgr.getWindow("PauseMenu/ResetButton")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&llm::Application::reset, app));//event du bouton
	wmgr.getWindow("PauseMenu/QuitButton")->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&llm::Application::quit, app));//event du bouton

	desactive();
}