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);
		}
	}
}
Example #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());
    }