Пример #1
0
	void DemoKeeper::createScene()
	{
		//MyGUI::LayoutManager::getInstance().loadLayout("Wallpaper.layout");

		//const MyGUI::VectorWidgetPtr& root = MyGUI::LayoutManager::getInstance().loadLayout("HelpPanel.layout");
		//root.at(0)->findWidget("Text")->castType<MyGUI::TextBox>()->setCaption("Demonstration of using different widgets and styles (something like Ogre Demo_Gui).");

		mMainPanel = new MainPanel();
		mMainPanel->eventAction = MyGUI::newDelegate(this, &DemoKeeper::notifyEventAction);
		mMainPanel->addObject("FrameWindow");
		mMainPanel->addObject("Horizontal Scrollbar");
		mMainPanel->addObject("Vertical Scrollbar");
		mMainPanel->addObject("TextBox");
		mMainPanel->addObject("ImageBox");
		mMainPanel->addObject("Render to Texture");

		mEditorWindow = new EditorWindow();
		
		MyGUI::FontManager& fontmanager = MyGUI::FontManager::getInstance();

		MyGUI::IFont* font = fontmanager.getByName(fontmanager.getDefaultFont());
#ifdef MYGUI_COCOS2D_PLATFORM
		CCScene* scene = HelloWorld::scene();
		cocos2d::CCDirector::sharedDirector()->runWithScene(scene);

		MyGUI::Cocos2dTexture* texture = (MyGUI::Cocos2dTexture*)font->getTextureFont();

		CCSprite* fontTexture = CCSprite::createWithTexture(texture->getCocos2dTexture());
		scene->addChild(fontTexture);
		fontTexture->setPosition(CCPoint(scene->getContentSize().width / 2, scene->getContentSize().height / 2));
#endif
	}
Пример #2
0
CCScene *WCGame::scene() {
    CCScene *scene = CCScene::create();
    
    CCSprite *bg = CCSprite::create("bggame1.jpg");
    bg->setPosition(CCPoint(scene->getContentSize().width / 2, scene->getContentSize().height / 2));
    
    WCGame *layer = WCGame::create();
    
    scene->addChild(bg, 0);
    scene->addChild(layer, 1);
    
    return scene;
}