void BaseApp::onCursorChange(const std::string &name)
{
	if (!mCursorManager->cursorChanged(name))
		return;  // the cursor manager doesn't want any more info about this cursor
	//  See if we can get the information we need out of the cursor resource
	ResourceImageSetPointerFix* imgSetPtr = dynamic_cast<ResourceImageSetPointerFix*>(MyGUI::PointerManager::getInstance().getByName(name));
	if (imgSetPtr != NULL)
	{
		MyGUI::ResourceImageSet* imgSet = imgSetPtr->getImageSet();
		std::string tex_name = imgSet->getIndexInfo(0,0).texture;
		Ogre::TexturePtr tex = Ogre::TextureManager::getSingleton().getByName(tex_name);

		//  everything looks good, send it to the cursor manager
		if (!tex.isNull())
		{
			Uint8 size_x = imgSetPtr->getSize().width;
			Uint8 size_y = imgSetPtr->getSize().height;
			Uint8 left = imgSetPtr->getTexturePosition().left;
			Uint8 top = imgSetPtr->getTexturePosition().top;
			Uint8 hotspot_x = imgSetPtr->getHotSpot().left;
			Uint8 hotspot_y = imgSetPtr->getHotSpot().top;

			mCursorManager->receiveCursorInfo(name, tex, left, top, size_x, size_y, hotspot_x, hotspot_y);
		}
	}
}
Beispiel #2
0
    void Cursor::onCursorChange(const std::string &name)
    {
        ResourceImageSetPointerFix* imgSetPtr = dynamic_cast<ResourceImageSetPointerFix*>(
                    MyGUI::PointerManager::getInstance().getByName(name));
        assert(imgSetPtr != NULL);

        MyGUI::ResourceImageSet* imgSet = imgSetPtr->getImageSet();

        std::string texture = imgSet->getIndexInfo(0,0).texture;

        mSize = imgSetPtr->getSize();
        mHotSpot = imgSetPtr->getHotSpot();

        int rotation = imgSetPtr->getRotation();

        mWidget->setImageTexture(texture);
        MyGUI::ISubWidget* main = mWidget->getSubWidgetMain();
        MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
        rotatingSubskin->setCenter(MyGUI::IntPoint(mSize.width/2,mSize.height/2));
        rotatingSubskin->setAngle(Ogre::Degree(rotation).valueRadians());
    }
Beispiel #3
0
	void DemoKeeper::createScene()
	{
		base::BaseDemoManager::createScene();
		new tools::DataInfoManager();
		new tools::DataManager();
		new tools::ActionManager();
		
		tools::DataInfoManager::getInstance().initialise();
		tools::DataManager::getInstance().initialise();
		tools::ActionManager::getInstance().initialise();

		tools::DataInfoManager::getInstance().load("ImageDataInfo.xml");

		mDataListUI = new DataListUI();

		A a;
		B b;

		b.advise(&a);
		b.advise(&a);


		MyGUI::IndexImage index;
		index.name = "MyIndex1";
		index.rate = 0;
		index.frames.push_back(MyGUI::IntPoint(0, 0));

		MyGUI::GroupImage group;
		group.name = "MyGroup1";
		group.texture = "MyTexture1.png";
		group.size = MyGUI::texture_utility::getTextureSize(group.texture, false);
		group.indexes.push_back(index);

		std::string category = MyGUI::ResourceManager::getInstance().getCategoryName();
		MyGUI::ResourceImageSet* imageSet = MyGUI::FactoryManager::getInstance().createObject<MyGUI::ResourceImageSet>(category);
		imageSet->setResourceName("ResourceImageSet_Manual1");
		imageSet->AddGroupImage(group);

		MyGUI::ResourceManager::getInstance().addResource(imageSet);
	}