Exemple #1
0
void LocalMapBase::setPlayerDir(const float x, const float y)
{
    if (x == mLastDirectionX && y == mLastDirectionY)
        return;
    MyGUI::ISubWidget* main = mCompass->getSubWidgetMain();
    MyGUI::RotatingSkin* rotatingSubskin = main->castType<MyGUI::RotatingSkin>();
    rotatingSubskin->setCenter(MyGUI::IntPoint(16,16));
    float angle = std::atan2(x,y);
    rotatingSubskin->setAngle(angle);

    mLastDirectionX = x;
    mLastDirectionY = y;
}
Exemple #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());
    }