当前位置: 首页>>代码示例>>C++>>正文


C++ Window::addChild方法代码示例

本文整理汇总了C++中cegui::Window::addChild方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::addChild方法的具体用法?C++ Window::addChild怎么用?C++ Window::addChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cegui::Window的用法示例。


在下文中一共展示了Window::addChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initialiseWidgetInspector

void WidgetDemo::initialiseWidgetInspector(CEGUI::Window* container)
{
    WindowManager& winMgr = WindowManager::getSingleton();

    //Add a tabcontrol serving as WidgetInspector, allowing to switch between events+widgets and the properties display
    TabControl* tabControl = static_cast<TabControl*>(winMgr.createWindow("TaharezLook/TabControl", "WidgetDemoWidgetInspector"));
    container->addChild(tabControl);
    tabControl->setSize(CEGUI::USize(cegui_reldim(0.55f), cegui_reldim(0.96f)));
    tabControl->setPosition(CEGUI::UVector2(cegui_reldim(0.02f), cegui_reldim(0.02f)));

    //Create the respective windows containing the displays
    CEGUI::Window* widgetMainInspectionContainer = winMgr.createWindow("DefaultWindow", "WidgetInspectionContainer");
    CEGUI::Window* widgetPropertiesInspectionContainer = winMgr.createWindow("DefaultWindow", "WidgetPropertiesInspectionContainer");


    //Add the pages to the tab control
    widgetMainInspectionContainer->setText("Widget Inspector");
    tabControl->addTab(widgetMainInspectionContainer);
    widgetPropertiesInspectionContainer->setText("Widget Properties");
    tabControl->addTab(widgetPropertiesInspectionContainer);

    //Create properties window
    initialiseWidgetPropertiesDisplayWindow(widgetPropertiesInspectionContainer);

    //Create the widget display windows
    initialiseWidgetDisplayWindow();
    widgetMainInspectionContainer->addChild(d_widgetDisplayWindow);

    initialiseWidgetsEventsLog();
    widgetMainInspectionContainer->addChild(d_widgetsEventsLog);

    initialiseEventLights(widgetMainInspectionContainer);
}
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:33,代码来源:WidgetDemo.cpp

示例2: initialiseEventLights

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");
}
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:35,代码来源:WidgetDemo.cpp

示例3: listDir

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);

}
开发者ID:RubenCardos,项目名称:CrackShot,代码行数:55,代码来源:MenuState.cpp

示例4: memBuffer

bool
CFormBackendImp::LoadLayout( GUCEF::CORE::CIOAccess& layoutStorage )
{GUCEF_TRACE;
    
    CEGUI::Window* rootWindow = NULL;
    CEGUI::WindowManager* wmgr = CEGUI::WindowManager::getSingletonPtr();
    
    GUCEF_DEBUG_LOG( 0, "Starting layout load for a GUI Form" );
    
    try
    {
        CORE::CDynamicBuffer memBuffer( layoutStorage );
        CEGUI::RawDataContainer container;

        container.setData( (CEGUI::uint8*) memBuffer.GetBufferPtr() );
        container.setSize( (size_t) memBuffer.GetDataSize() );

        rootWindow = wmgr->loadLayoutFromContainer( container );

        container.setData( (CEGUI::uint8*) NULL );
        container.setSize( (size_t) 0 );
    }
    catch ( CEGUI::Exception& e )
    {
        GUCEF_ERROR_LOG( 0, CString( "CEGUI Exception while attempting to load form layout: " ) + e.what() );
        return false;
    }
    
    // Now that we completed loading lets see what we got from CEGUI
    if ( NULL != rootWindow )
    {
        // Begin by providing a wrapper for the root window
        m_rootWindow = CreateAndHookWrapperForWindow( rootWindow );
        if ( NULL != m_rootWindow )
        {
            CString localWidgetName = m_rootWindow->GetName().SubstrToChar( '/', false );
            m_widgetMap[ localWidgetName ] = m_rootWindow;
            WrapAndHookChildWindows( rootWindow );
            
            // We will directly add the form as a child of the root for now
            // Note: This assumes that you have a GUISheet already set, otherwise this will result in a segfault!
            CEGUI::Window* globalRootWindow = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();
            if ( NULL != globalRootWindow )
            {
                globalRootWindow->addChild( rootWindow );
                
                GUCEF_DEBUG_LOG( 0, "Successfully loaded a GUI Form layout" );
                return true;                
            }
            else
            {
                GUCEF_ERROR_LOG( 0, "Failed to add form as a child to the global \"root\" window" );    
            }
        }
        rootWindow->hide();
    }

    GUCEF_DEBUG_LOG( 0, "Failed to load a GUI Form layout" );
    return false; 
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:60,代码来源:guidriverCEGUI_CFormBackendImp.cpp

示例5: createGUI

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);
}
开发者ID:trojanwarrior,项目名称:HundirLaFlota2,代码行数:33,代码来源:PlayState.cpp

示例6:

GUIMessageBox::GUIMessageBox(void)
	: d_root(CEGUI::WindowManager::getSingleton().loadLayoutFromFile("MessageBox.layout"))
{
	using namespace CEGUI;

	CEGUI::Window* parent = NULL;

	// we will destroy the console box windows ourselves
	d_root->setDestroyedByParent(false);

	// Do events wire-up
//	d_root->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUIMessageBox::handleSubmit, this));

	d_root->getChild("Button")->
		subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUIMessageBox::handleSubmit, this));

	/*CEGUI::Window* d_fontNameEditbox = static_cast<CEGUI::Editbox*>(d_root->getChild("Login/Name"));
	d_fontNameEditbox->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUILogin::handleSubmit, this));

	d_root->getChild("Login/PassText")->
		subscribeEvent(Editbox::EventTextAccepted, Event::Subscriber(&GUILogin::handleSubmit, this));


	d_root->getChild("Login/Submit")->subscribeEvent(PushButton::EventClicked, Event::Subscriber(&GUILogin::handleSubmit, this));
	*/
	// decide where to attach the console main window
	parent = parent ? parent : CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

	// attach this window if parent is valid
	if (parent)
		parent->addChild(d_root);
}
开发者ID:BornHunter,项目名称:CGSF,代码行数:32,代码来源:GUIMessageBox.cpp

示例7: createScene

//-------------------------------------------------------------------------------------
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);
}
开发者ID:hslee613,项目名称:Tutorial,代码行数:27,代码来源:TutorialApplication.cpp

示例8: spawnPlate

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;
}
开发者ID:scw000000,项目名称:Engine,代码行数:43,代码来源:HUDemo.cpp

示例9: initialiseWidgetSelector

void WidgetDemo::initialiseWidgetSelector(CEGUI::Window* container)
{
    WindowManager& winMgr = WindowManager::getSingleton();

    initialiseSkinCombobox(container);

    CEGUI::Window* widgetSelectorContainer = winMgr.createWindow("Vanilla/StaticText", "WidgetSelectorContainer");
    initialiseWidgetSelectorContainer(widgetSelectorContainer);
    container->addChild(widgetSelectorContainer);

    initialiseWidgetSelectorListbox();
    widgetSelectorContainer->addChild(d_widgetSelectorListbox);
}
开发者ID:AjaxWang1989,项目名称:cegui,代码行数:13,代码来源:WidgetDemo.cpp

示例10: OnEnter

bool GUILogin::OnEnter()
{
	CEGUI::Window* parent = NULL;

	// decide where to attach the console main window
	parent = parent ? parent : CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

	// attach this window if parent is valid
	if (parent)
		parent->addChild(d_root);

	return true;
}
开发者ID:JJMoon,项目名称:CGSF,代码行数:13,代码来源:GUILogin.cpp

示例11: OnEnter

bool GUILobby::OnEnter()
{
	CEGUI::Window* parent = NULL;

	// decide where to attach the console main window
	parent = parent ? parent : CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow();

	// attach this window if parent is valid
	if (parent)
		parent->addChild(d_root);

	Listbox* lbox = static_cast<Listbox*>(d_root->getChild("RoomList"));
	lbox->resetList();

	return true;
}
开发者ID:BornHunter,项目名称:CGSF,代码行数:16,代码来源:GUILobby.cpp

示例12: initializeKeyMap

GameDesktop::GameDesktop(sf::RenderWindow &screen)
  : screen_(screen),
    renderer_(CEGUI::OpenGLRenderer::bootstrapSystem())
{
  // Set up default resource groups
  CEGUI::DefaultResourceProvider *rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());

  rp->setResourceGroupDirectory("schemes", "/usr/share/cegui-0/schemes/"); 
  rp->setResourceGroupDirectory("imagesets", "/usr/share/cegui-0/imagesets/");
  rp->setResourceGroupDirectory("fonts", "/usr/share/cegui-0/fonts/");
  rp->setResourceGroupDirectory("layouts", "/usr/share/cegui-0/layouts/");
  rp->setResourceGroupDirectory("looknfeels", "/usr/share/cegui-0/looknfeel");
  rp->setResourceGroupDirectory("lua_scripts", "/usr/share/cegui-0/lua_scripts/");

  CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");
  CEGUI::Font::setDefaultResourceGroup("fonts");
  CEGUI::Scheme::setDefaultResourceGroup("schemes");
  CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
  CEGUI::WindowManager::setDefaultResourceGroup("layouts");
  CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");

  // Set up the GUI
  CEGUI::SchemeManager::getSingleton().createFromFile("WindowsLook.scheme");
  CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-10.font");

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

  CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
  CEGUI::Window *root = wmgr.createWindow("DefaultWindow", "root");
  root->setProperty("MousePassThroughEnabled", "True");
  CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(root);

  CEGUI::FrameWindow *fw = static_cast<CEGUI::FrameWindow*>(wmgr.createWindow("WindowsLook/FrameWindow", "testWindow"));

  root->addChild(fw);
  fw->setText("Hello World!");

  // Initialize SFML-to-CEGUI key mapping
  initializeKeyMap();
  screen_.setView(view_);
}
开发者ID:ghtyrant,项目名称:SFML_CEGUI,代码行数:41,代码来源:gamedesktop.cpp

示例13: USize

time_panel_impl::time_panel_impl()
{
    GUIContext& context = System::getSingleton().getDefaultGUIContext();
    CEGUI::Window* root = context.getRootWindow();

    WindowManager& winMgr = WindowManager::getSingleton();

    //PushButton* TimeButtonOK = static_cast<PushButton*>(
    //    WindowManager::getSingleton().createWindow("TaharezLook/Button", "TimeButtonOK") );
    //TimeButtonOK->setPosition(UVector2(cegui_reldim(0.1f), cegui_reldim(0.75f)));
    //TimeButtonOK->setSize( USize(cegui_reldim(0.4f), cegui_reldim(0.15f)) );
    //TimeButtonOK->setText( "OK" );
    //root->addChild(TimeButtonOK);

    Window* TimeLabel = static_cast<Window*>(
                            WindowManager::getSingleton().createWindow("TaharezLook/Label", label_name) );
    TimeLabel->setPosition(UVector2(cegui_reldim(0.75f), cegui_reldim(0.f)));
    TimeLabel->setSize( USize(cegui_reldim(0.4f), cegui_reldim(0.15f)) );

    root->addChild(TimeLabel);

    set_time(0);
}
开发者ID:yaroslav-tarasov,项目名称:test_osg,代码行数:23,代码来源:time_panel_impl.cpp

示例14: init


//.........这里部分代码省略.........
	CEGUI::System::getSingleton().getDefaultGUIContext().
		getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");

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


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


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

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

		//}
		

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

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


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



		// Inventory testing:
		{
			// Create Backpack window

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

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

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

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

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

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

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

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

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

	}

}
开发者ID:CheeseSoftware,项目名称:Cheese-Leather-2D,代码行数:101,代码来源:CEGUIManager.cpp

示例15: gameScore

ScoreManager::ScoreManager(void) : gameScore(0), highScoreFile(), highScore(0), lives(5), gameOverB(false), scoreLabel("SCORE_"), scoreText("Score: "), highScoreLabel("HIGH_SCORE_"), highScoreText("High Score: "), livesText("Lives: ") {
	/* The global timer */
	timer = new Ogre::Timer();
	dt = timer->getMilliseconds();

	/* Load Score Resources */

	highScoreFile.open("highscore.txt", std::ios::in);

	std::string line;
	while(getline(highScoreFile, line)) {
		if(line == "") {
			highScore = 0;
		}
		else {
			highScore = std::stoi(line);
		}
	}

	highScoreFile.close();
	// Ogre::Overlay* ov = Ogre::OverlayManager::getSingletonPtr()->create("Overlay");
	// ov->show();

	// scoreOverlay = new TextOverlay(ov, scoreLabel, 0.02f, 0.9f, 0.04f);
	// scoreOverlay->setCol(1.0f, 1.0f, 1.0f, 1.0f);
	// highScoreOverlay = new TextOverlay(ov, highScoreLabel, 0.67f, 0.9f, 0.04f);
	// highScoreOverlay->setCol(1.0f, 1.0f, 1.0f, 1.0f);
	// gameOverOverlay = new TextOverlay(ov, gameOverLabel, 0.2f, 0.3f, 0.1f);
	// gameOverOverlay->setCol(1.0f, 0.1f, 0.1f, 1.0f);

	CEGUI::WindowManager &wmgr = CEGUI::WindowManager::getSingleton();
	CEGUI::Window *sheet = CEGUI::System::getSingleton().getDefaultGUIContext().getRootWindow(); 

	gameScoreboard = wmgr.createWindow("AlfiskoSkin/Label", "Points");
	gameScoreboard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.0f, 0), CEGUI::UDim(0.92f, 0)),
	CEGUI::UVector2(CEGUI::UDim(0.2f, 0), CEGUI::UDim(1, 0))));
	gameScoreboard->setText("Points: 0");

	highscoreBoard = wmgr.createWindow("AlfiskoSkin/Label", "HighScore");
	highscoreBoard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.35f, 0), CEGUI::UDim(0.92f, 0)),
	CEGUI::UVector2(CEGUI::UDim(0.7f, 0), CEGUI::UDim(1, 0))));
	highscoreBoard->setText("High Score: " + std::to_string(highScore));

	youWinBoard = wmgr.createWindow("AlfiskoSkin/Editbox", "YouWinBoard");
	youWinBoard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.42f, 0), CEGUI::UDim(0.33f, 0)),
		CEGUI::UVector2(CEGUI::UDim(0.58f, 0), CEGUI::UDim(0.4f, 0))));
	youWinBoard->setText("     You Win!");
	youWinBoard->setDisabled(true);
	youWinBoard->setMouseCursor("AlfiskoSkin/MouseArrow");
	youWinBoard->hide();

	youLoseBoard = wmgr.createWindow("AlfiskoSkin/Editbox", "YouLoseBoard");
	youLoseBoard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.42f, 0), CEGUI::UDim(0.33f, 0)),
		CEGUI::UVector2(CEGUI::UDim(0.58f, 0), CEGUI::UDim(0.4f, 0))));
	youLoseBoard->setText("  Game Over!");
	youLoseBoard->setDisabled(true);
	youLoseBoard->setMouseCursor("AlfiskoSkin/MouseArrow");
	youLoseBoard->hide();

	livesBoard = wmgr.createWindow("AlfiskoSkin/Label", "Lives");
	livesBoard->setArea(CEGUI::URect(CEGUI::UVector2(CEGUI::UDim(0.8f, 0), CEGUI::UDim(0.92f, 0)),
		CEGUI::UVector2(CEGUI::UDim(1, 0), CEGUI::UDim(1, 0))));
	livesBoard->setText("Lives: 5");

	sheet->addChild(gameScoreboard);
	sheet->addChild(livesBoard);
	sheet->addChild(highscoreBoard);
	sheet->addChild(youWinBoard);
	sheet->addChild(youLoseBoard);
}
开发者ID:koalanis,项目名称:oort,代码行数:70,代码来源:ScoreManager.cpp


注:本文中的cegui::Window::addChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。