Exemplo n.º 1
0
void Dock::hide()
{
    getWidget().hide();
}
Exemplo n.º 2
0
 virtual void hide() { getWidget()->hide(); };
Exemplo n.º 3
0
 WaitDialogProgressBar::WaitDialogProgressBar()
     : WindowBase("openmw_wait_dialog_progressbar.layout")
 {
     getWidget(mProgressBar, "ProgressBar");
     getWidget(mProgressText, "ProgressText");
 }
Exemplo n.º 4
0
    TradeWindow::TradeWindow(MWBase::WindowManager& parWindowManager) :
        WindowBase("openmw_trade_window.layout", parWindowManager)
        , ContainerBase(NULL) // no drag&drop
        , mCurrentBalance(0)
    {
        MyGUI::ScrollView* itemView;
        MyGUI::Widget* containerWidget;
        getWidget(containerWidget, "Items");
        getWidget(itemView, "ItemView");
        setWidgets(containerWidget, itemView);

        getWidget(mFilterAll, "AllButton");
        getWidget(mFilterWeapon, "WeaponButton");
        getWidget(mFilterApparel, "ApparelButton");
        getWidget(mFilterMagic, "MagicButton");
        getWidget(mFilterMisc, "MiscButton");

        getWidget(mMaxSaleButton, "MaxSaleButton");
        getWidget(mCancelButton, "CancelButton");
        getWidget(mOfferButton, "OfferButton");
        getWidget(mPlayerGold, "PlayerGold");
        getWidget(mMerchantGold, "MerchantGold");
        getWidget(mIncreaseButton, "IncreaseButton");
        getWidget(mDecreaseButton, "DecreaseButton");
        getWidget(mTotalBalance, "TotalBalance");
        getWidget(mTotalBalanceLabel, "TotalBalanceLabel");
        getWidget(mBottomPane, "BottomPane");

        // adjust size of buttons to fit text
        int curX = 0;
        mFilterAll->setSize( mFilterAll->getTextSize().width + 24, mFilterAll->getSize().height );
        curX += mFilterAll->getTextSize().width + 24 + 4;

        mFilterWeapon->setPosition(curX, mFilterWeapon->getPosition().top);
        mFilterWeapon->setSize( mFilterWeapon->getTextSize().width + 24, mFilterWeapon->getSize().height );
        curX += mFilterWeapon->getTextSize().width + 24 + 4;

        mFilterApparel->setPosition(curX, mFilterApparel->getPosition().top);
        mFilterApparel->setSize( mFilterApparel->getTextSize().width + 24, mFilterApparel->getSize().height );
        curX += mFilterApparel->getTextSize().width + 24 + 4;

        mFilterMagic->setPosition(curX, mFilterMagic->getPosition().top);
        mFilterMagic->setSize( mFilterMagic->getTextSize().width + 24, mFilterMagic->getSize().height );
        curX += mFilterMagic->getTextSize().width + 24 + 4;

        mFilterMisc->setPosition(curX, mFilterMisc->getPosition().top);
        mFilterMisc->setSize( mFilterMisc->getTextSize().width + 24, mFilterMisc->getSize().height );

        mFilterAll->setStateSelected(true);

        mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterMagic->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterMisc->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);

        mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onCancelButtonClicked);
        mOfferButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onOfferButtonClicked);

        mMaxSaleButton->setSize(MyGUI::IntSize(mMaxSaleButton->getTextSize().width + 24, mMaxSaleButton->getHeight()));

        int cancelButtonWidth = mCancelButton->getTextSize().width + 24;
        mCancelButton->setCoord(mBottomPane->getWidth()-cancelButtonWidth,
                                mCancelButton->getTop(),
                                cancelButtonWidth,
                                mCancelButton->getHeight());

        int offerButtonWidth = mOfferButton->getTextSize().width + 24;
        mOfferButton->setCoord(mBottomPane->getWidth()-cancelButtonWidth-offerButtonWidth-8,
                                mOfferButton->getTop(),
                                offerButtonWidth,
                                mOfferButton->getHeight());

        setCoord(400, 0, 400, 300);

        static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &TradeWindow::onWindowResize);
    }
Exemplo n.º 5
0
    HUD::HUD(int width, int height, int fpsLevel, DragAndDrop* dragAndDrop)
        : Layout("openmw_hud.layout")
        , mHealth(NULL)
        , mMagicka(NULL)
        , mStamina(NULL)
        , mDrowning(NULL)
        , mDrowningFrame(NULL)
        , mDrowningFlash(NULL)
        , mWeapImage(NULL)
        , mSpellImage(NULL)
        , mWeapStatus(NULL)
        , mSpellStatus(NULL)
        , mEffectBox(NULL)
        , mMinimap(NULL)
        , mCompass(NULL)
        , mCrosshair(NULL)
        , mFpsBox(NULL)
        , mFpsCounter(NULL)
        , mTriangleCounter(NULL)
        , mBatchCounter(NULL)
        , mHealthManaStaminaBaseLeft(0)
        , mWeapBoxBaseLeft(0)
        , mSpellBoxBaseLeft(0)
        , mEffectBoxBaseRight(0)
        , mMinimapBoxBaseRight(0)
        , mDragAndDrop(dragAndDrop)
        , mCellNameTimer(0.0f)
        , mCellNameBox(NULL)
        , mMapVisible(true)
        , mWeaponVisible(true)
        , mSpellVisible(true)
        , mWorldMouseOver(false)
        , mEnemyHealthTimer(-1)
        , mIsDrowning(false)
        , mWeaponSpellTimer(0.f)
        , mDrowningFlashTheta(0.f)
    {
        setCoord(0,0, width, height);

        // Energy bars
        getWidget(mHealthFrame, "HealthFrame");
        getWidget(mHealth, "Health");
        getWidget(mMagicka, "Magicka");
        getWidget(mStamina, "Stamina");
        getWidget(mEnemyHealth, "EnemyHealth");
        mHealthManaStaminaBaseLeft = mHealthFrame->getLeft();

        MyGUI::Widget *healthFrame, *magickaFrame, *fatigueFrame;
        getWidget(healthFrame, "HealthFrame");
        getWidget(magickaFrame, "MagickaFrame");
        getWidget(fatigueFrame, "FatigueFrame");
        healthFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
        magickaFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
        fatigueFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);

        //Drowning bar
        getWidget(mDrowningFrame, "DrowningFrame");
        getWidget(mDrowning, "Drowning");
        getWidget(mDrowningFlash, "Flash");
        mDrowning->setProgressRange(200);

        const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();

        // Item and spell images and status bars
        getWidget(mWeapBox, "WeapBox");
        getWidget(mWeapImage, "WeapImage");
        getWidget(mWeapStatus, "WeapStatus");
        mWeapBoxBaseLeft = mWeapBox->getLeft();
        mWeapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWeaponClicked);

        getWidget(mSpellBox, "SpellBox");
        getWidget(mSpellImage, "SpellImage");
        getWidget(mSpellStatus, "SpellStatus");
        mSpellBoxBaseLeft = mSpellBox->getLeft();
        mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);

        getWidget(mSneakBox, "SneakBox");
        mSneakBoxBaseLeft = mSneakBox->getLeft();

        getWidget(mEffectBox, "EffectBox");
        mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();

        getWidget(mMinimapBox, "MiniMapBox");
        mMinimapBoxBaseRight = viewSize.width - mMinimapBox->getRight();
        getWidget(mMinimap, "MiniMap");
        getWidget(mCompass, "Compass");
        getWidget(mMinimapButton, "MiniMapButton");
        mMinimapButton->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);

        getWidget(mCellNameBox, "CellName");
        getWidget(mWeaponSpellBox, "WeaponSpellName");

        getWidget(mCrosshair, "Crosshair");

        setFpsLevel(fpsLevel);

        getWidget(mTriangleCounter, "TriangleCounter");
        getWidget(mBatchCounter, "BatchCounter");

        LocalMapBase::init(mMinimap, mCompass, this);

        mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked);
        mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver);
        mMainWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &HUD::onWorldMouseLostFocus);

        mSpellIcons = new SpellIcons();
    }
Exemplo n.º 6
0
    RaceDialog::RaceDialog(osg::Group* parent, Resource::ResourceSystem* resourceSystem)
      : WindowModal("openmw_chargen_race.layout")
      , mParent(parent)
      , mResourceSystem(resourceSystem)
      , mGenderIndex(0)
      , mFaceIndex(0)
      , mHairIndex(0)
      , mCurrentAngle(0)
      , mPreviewDirty(true)
    {
        // Centre dialog
        center();

        setText("AppearanceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu1", "Appearance"));
        getWidget(mPreviewImage, "PreviewImage");

        getWidget(mHeadRotate, "HeadRotate");

        mHeadRotate->setScrollRange(1000);
        mHeadRotate->setScrollPosition(500);
        mHeadRotate->setScrollViewPage(50);
        mHeadRotate->setScrollPage(50);
        mHeadRotate->setScrollWheelPage(50);
        mHeadRotate->eventScrollChangePosition += MyGUI::newDelegate(this, &RaceDialog::onHeadRotate);

        // Set up next/previous buttons
        MyGUI::Button *prevButton, *nextButton;

        setText("GenderChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu2", "Change Sex"));
        getWidget(prevButton, "PrevGenderButton");
        getWidget(nextButton, "NextGenderButton");
        prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousGender);
        nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextGender);

        setText("FaceChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu3", "Change Face"));
        getWidget(prevButton, "PrevFaceButton");
        getWidget(nextButton, "NextFaceButton");
        prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousFace);
        nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextFace);

        setText("HairChoiceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu4", "Change Hair"));
        getWidget(prevButton, "PrevHairButton");
        getWidget(nextButton, "NextHairButton");
        prevButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectPreviousHair);
        nextButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onSelectNextHair);

        setText("RaceT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu5", "Race"));
        getWidget(mRaceList, "RaceList");
        mRaceList->setScrollVisible(true);
        mRaceList->eventListSelectAccept += MyGUI::newDelegate(this, &RaceDialog::onAccept);
        mRaceList->eventListChangePosition += MyGUI::newDelegate(this, &RaceDialog::onSelectRace);

        setText("SkillsT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sBonusSkillTitle", "Skill Bonus"));
        getWidget(mSkillList, "SkillList");
        setText("SpellPowerT", MWBase::Environment::get().getWindowManager()->getGameSettingString("sRaceMenu7", "Specials"));
        getWidget(mSpellPowerList, "SpellPowerList");

        MyGUI::Button* backButton;
        getWidget(backButton, "BackButton");
        backButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onBackClicked);

        MyGUI::Button* okButton;
        getWidget(okButton, "OKButton");
        okButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sOK", ""));
        okButton->eventMouseButtonClick += MyGUI::newDelegate(this, &RaceDialog::onOkClicked);

        updateRaces();
        updateSkills();
        updateSpellPowers();
    }
Exemplo n.º 7
0
    TradeWindow::TradeWindow()
        : WindowBase("openmw_trade_window.layout")
        , mSortModel(NULL)
        , mTradeModel(NULL)
        , mItemToSell(-1)
        , mCurrentBalance(0)
        , mCurrentMerchantOffer(0)
    {
        getWidget(mFilterAll, "AllButton");
        getWidget(mFilterWeapon, "WeaponButton");
        getWidget(mFilterApparel, "ApparelButton");
        getWidget(mFilterMagic, "MagicButton");
        getWidget(mFilterMisc, "MiscButton");

        getWidget(mMaxSaleButton, "MaxSaleButton");
        getWidget(mCancelButton, "CancelButton");
        getWidget(mOfferButton, "OfferButton");
        getWidget(mPlayerGold, "PlayerGold");
        getWidget(mMerchantGold, "MerchantGold");
        getWidget(mIncreaseButton, "IncreaseButton");
        getWidget(mDecreaseButton, "DecreaseButton");
        getWidget(mTotalBalance, "TotalBalance");
        getWidget(mTotalBalanceLabel, "TotalBalanceLabel");
        getWidget(mBottomPane, "BottomPane");

        getWidget(mItemView, "ItemView");
        mItemView->eventItemClicked += MyGUI::newDelegate(this, &TradeWindow::onItemSelected);

        mFilterAll->setStateSelected(true);

        mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterMagic->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);
        mFilterMisc->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onFilterChanged);

        mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onCancelButtonClicked);
        mOfferButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onOfferButtonClicked);
        mMaxSaleButton->eventMouseButtonClick += MyGUI::newDelegate(this, &TradeWindow::onMaxSaleButtonClicked);
        mIncreaseButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &TradeWindow::onIncreaseButtonPressed);
        mIncreaseButton->eventMouseButtonReleased += MyGUI::newDelegate(this, &TradeWindow::onBalanceButtonReleased);
        mDecreaseButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &TradeWindow::onDecreaseButtonPressed);
        mDecreaseButton->eventMouseButtonReleased += MyGUI::newDelegate(this, &TradeWindow::onBalanceButtonReleased);

        mTotalBalance->eventValueChanged += MyGUI::newDelegate(this, &TradeWindow::onBalanceValueChanged);
        mTotalBalance->eventEditSelectAccept += MyGUI::newDelegate(this, &TradeWindow::onAccept);
        mTotalBalance->setMinValue(INT_MIN+1); // disallow INT_MIN since abs(INT_MIN) is undefined

        setCoord(400, 0, 400, 300);
    }
Exemplo n.º 8
0
/** This determines the layout, i.e. the size of all columns, font size etc.
 */
void RaceResultGUI::determineTableLayout()
{
    GUIEngine::Widget *table_area = getWidget("result-table");

    m_font          = GUIEngine::getFont();
    assert(m_font);
    m_was_monospace = m_font->getMonospaceDigits();
    m_font->setMonospaceDigits(true);
    WorldWithRank *rank_world = (WorldWithRank*)World::getWorld();

    unsigned int first_position = 1;
    if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
        first_position = 2;

    // Use only the karts that are supposed to be displayed (and
    // ignore e.g. the leader in a FTL race).
    unsigned int num_karts =race_manager->getNumberOfKarts()-first_position+1;

    // In FTL races the leader kart is not displayed
    m_all_row_infos.resize(num_karts);


    // Determine the kart to display in the right order,
    // and the maximum width for the kart name column
    // -------------------------------------------------
    m_width_kart_name     = 0;
    float max_finish_time = 0;


    for(unsigned int position=first_position;
        position<=race_manager->getNumberOfKarts(); position++)
    {
        const AbstractKart *kart = rank_world->getKartAtPosition(position);

        // Save a pointer to the current row_info entry
        RowInfo *ri              = &(m_all_row_infos[position-first_position]);
        ri->m_is_player_kart     = kart->getController()->isPlayerController();
        ri->m_kart_name          = translations->fribidize(kart->getName());
        ri->m_player             = ri->m_is_player_kart
                                 ? kart->getController()->getPlayer() : NULL;

        video::ITexture *icon    =
            kart->getKartProperties()->getIconMaterial()->getTexture();
        ri->m_kart_icon          = icon;

        if (kart->isEliminated())
        {
            ri->m_finish_time_string = core::stringw(_("Eliminated"));
        }
        else
        {
            const float time         = kart->getFinishTime();
            if(time > max_finish_time) max_finish_time = time;
            std::string time_string  = StringUtils::timeToString(time);
            ri->m_finish_time_string = time_string.c_str();
        }

        core::dimension2du rect =
            m_font->getDimension(ri->m_kart_name.c_str());
        if(rect.Width > m_width_kart_name)
            m_width_kart_name = rect.Width;
    }   // for position

    std::string max_time    = StringUtils::timeToString(max_finish_time);
    core::stringw string_max_time(max_time.c_str());
    core::dimension2du r    = m_font->getDimension(string_max_time.c_str());
    m_width_finish_time     = r.Width;

    // Top pixel where to display text
    m_top                   = table_area->m_y;

    // Height of the result display
    unsigned int height     = table_area->m_h;

    // Setup different timing information for the different phases
    // -----------------------------------------------------------
    // How much time between consecutive rows
    m_time_between_rows     = 0.1f;

    // How long it takes for one line to scroll from right to left
    m_time_single_scroll    = 0.2f;

    // Time to rotate the entries to the proper GP position.
    m_time_rotation         = 1.0f;

    // The time the first phase is being displayed: add the start time
    // of the last kart to the duration of the scroll plus some time
    // of rest before the next phase starts
    m_time_overall_scroll   = (num_karts-1)*m_time_between_rows
                            + m_time_single_scroll + 2.0f;

    // The time to increase the number of points.
    m_time_for_points       = 1.0f;

    // Determine text height
    r                       = m_font->getDimension(L"Y");
    m_distance_between_rows = (int)(1.5f*r.Height);

    // If there are too many karts, reduce size between rows
    if(m_distance_between_rows * num_karts > height)
        m_distance_between_rows = height / num_karts;

    m_width_icon = table_area->m_h<600
                 ? 27
                 : (int)(40*(table_area->m_w/800.0f));

    m_width_column_space  = 20;

    // Determine width of new points column

    m_font->setMonospaceDigits(true);
    core::dimension2du r_new_p = m_font->getDimension(L"+99");

    m_width_new_points         = r_new_p.Width;

    // Determine width of overall points column
    core::dimension2du r_all_p    = m_font->getDimension(L"999");
    m_font->setMonospaceDigits(false);

    m_width_all_points = r_all_p.Width;

    m_table_width = m_width_icon + m_width_column_space
                  + m_width_kart_name;

    if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_FOLLOW_LEADER)
        m_table_width += m_width_finish_time + m_width_column_space;

    // Only in GP mode are the points displayed.
    if (race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX)
        m_table_width += m_width_new_points + m_width_all_points
                      + 2 * m_width_column_space;

    m_leftmost_column = table_area->m_x;

    m_gp_progress_x = (int)(UserConfigParams::m_width*0.65);
}   // determineTableLayout
Exemplo n.º 9
0
//-----------------------------------------------------------------------------
void RaceResultGUI::displaySoccerResults()
{

    //Draw win text
    core::stringw resultText;
    static video::SColor color = video::SColor(255, 255, 255, 255);
    gui::IGUIFont* font = GUIEngine::getTitleFont();
    int currX = UserConfigParams::m_width/2;
    RowInfo *ri = &(m_all_row_infos[0]);
    int currY = (int)ri->m_y_pos; 
    SoccerWorld* soccerWorld = (SoccerWorld*)World::getWorld();
    int teamScore[2] = {soccerWorld->getScore(0), soccerWorld->getScore(1)};
    
    GUIEngine::Widget *table_area = getWidget("result-table");
    int height = table_area->m_h + table_area->m_y;

    if(teamScore[0] > teamScore[1])
    {
        resultText = _("Red Team Wins");
    }
    else if(teamScore[1] > teamScore[0])
    {
        resultText = _("Blue Team Wins");
    }
    else
    {
        //Cannot really happen now. Only in time limited matches.
        resultText = _("It's a draw");
    }
    core::rect<s32> pos(currX, currY, currX, currY);
    font->draw(resultText.c_str(), pos, color, true, true);
    
    core::dimension2du rect = m_font->getDimension(resultText.c_str());

    //Draw team scores:
    currY += rect.Height;
    currX /= 2;
    irr::video::ITexture* redTeamIcon = irr_driver->getTexture(FileManager::GUI,
                                                              "soccer_ball_red.png");
    irr::video::ITexture* blueTeamIcon = irr_driver->getTexture(FileManager::GUI,
                                                               "soccer_ball_blue.png");

    core::recti sourceRect(core::vector2di(0,0), redTeamIcon->getSize());
    core::recti destRect(currX, currY, currX+redTeamIcon->getSize().Width/2,
        currY+redTeamIcon->getSize().Height/2);
    draw2DImage(redTeamIcon, destRect,sourceRect,
        NULL,NULL, true);
    currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
    destRect = core::recti(currX, currY, currX+redTeamIcon->getSize().Width/2,
        currY+redTeamIcon->getSize().Height/2);
    draw2DImage(blueTeamIcon,destRect,sourceRect,
        NULL, NULL, true);
    
    resultText = StringUtils::toWString(teamScore[1]);
    rect = m_font->getDimension(resultText.c_str());
    currX += redTeamIcon->getSize().Width/4;
    currY += redTeamIcon->getSize().Height/2 + rect.Height/4;
    pos = core::rect<s32>(currX, currY, currX, currY);
    color = video::SColor(255,255,255,255);
    font->draw(resultText.c_str(), pos, color, true, false);

    currX -= UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
    resultText = StringUtils::toWString(teamScore[0]);
    pos = core::rect<s32>(currX,currY,currX,currY);
    font->draw(resultText.c_str(), pos, color, true, false);
    
    int centerX = UserConfigParams::m_width/2;
    pos = core::rect<s32>(centerX, currY, centerX, currY);
    font->draw("-", pos, color, true, false);

    //Draw goal scorers:
    //The red scorers:
    currY += rect.Height/2 + rect.Height/4;
    font = GUIEngine::getSmallFont();
    std::vector<int> scorers = soccerWorld->getScorers(0);
    std::vector<float> scoreTimes = soccerWorld->getScoreTimes(0);
    irr::video::ITexture* scorerIcon;

    int prevY = currY;
    for(unsigned int i=0; i<scorers.size(); i++)
    {
        resultText = soccerWorld->getKart(scorers.at(i))->
            getKartProperties()->getName();
        resultText.append(" ");
        resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str());
        rect = m_font->getDimension(resultText.c_str());

        if(height-prevY < ((short)scorers.size()+1)*(short)rect.Height)
            currY += (height-prevY)/((short)scorers.size()+1);
        else
            currY += rect.Height;

        if(currY > height) break;

        pos = core::rect<s32>(currX,currY,currX,currY);
        font->draw(resultText,pos, color, true, false);
        scorerIcon = soccerWorld->getKart(scorers.at(i))
                                ->getKartProperties()->getIconMaterial()->getTexture();
        sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize());
        irr::u32 offsetX = GUIEngine::getFont()->getDimension(resultText.c_str()).Width/2;
        destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30);
        draw2DImage(scorerIcon, destRect, sourceRect,
            NULL, NULL, true);
    }

    //The blue scorers:
    currY = prevY;
    currX += UserConfigParams::m_width/2 - redTeamIcon->getSize().Width/2;
    scorers = soccerWorld->getScorers(1);
    scoreTimes = soccerWorld->getScoreTimes(1);
    for(unsigned int i=0; i<scorers.size(); i++)
    {
        resultText = soccerWorld->getKart(scorers.at(i))->
            getKartProperties()->getName();
        resultText.append(" ");
        resultText.append(StringUtils::timeToString(scoreTimes.at(i)).c_str());
        rect = m_font->getDimension(resultText.c_str());
        
        if(height-prevY < ((short)scorers.size()+1)*(short)rect.Height)
            currY += (height-prevY)/((short)scorers.size()+1);
        else
            currY += rect.Height;

        if(currY > height) break;

        pos = core::rect<s32>(currX,currY,currX,currY);
        font->draw(resultText,pos, color, true, false);
        scorerIcon = soccerWorld->getKart(scorers.at(i))->
                     getKartProperties()->getIconMaterial()->getTexture();
        sourceRect = core::recti(core::vector2di(0,0), scorerIcon->getSize());
        irr::u32 offsetX = GUIEngine::getFont()->getDimension(resultText.c_str()).Width/2;

        destRect = core::recti(currX-offsetX-30, currY, currX-offsetX, currY+ 30);
        draw2DImage(scorerIcon, destRect, sourceRect,
            NULL, NULL, true);
    }
}
Exemplo n.º 10
0
/** Makes the correct buttons visible again, and gives them the right label.
 *  1) If something was unlocked, only a 'next' button is displayed.
 */
void RaceResultGUI::enableAllButtons()
{
    GUIEngine::Widget *top    = getWidget("top");
    GUIEngine::Widget *middle = getWidget("middle");
    GUIEngine::Widget *bottom = getWidget("bottom");

    if (race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX)
    {
        enableGPProgress();
    }

    // If we're in a network world, change the buttons text
    if (World::getWorld()->isNetworkWorld())
    {
        Log::info("This work was networked", "This is a network world.");
        top->setVisible(false);
        middle->setText( _("Continue.") );
        middle->setVisible(true);
        middle->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
        bottom->setText( _("Quit the server.") );
        bottom->setVisible(true);
        if (race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX)
        {
            middle->setVisible(false); // you have to wait the server to start again
            bottom->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
        }
        return;
    }
    Log::info("This work was NOT networked", "This is NOT a network world.");

    // If something was unlocked
    // -------------------------
    int n = unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size();
    if(n>0)
    {
        top->setText(n==1 ? _("You completed a challenge!")
                          : _("You completed challenges!"));
        top->setVisible(true);
        top->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
    }
    else if (race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX)
    {
        // In case of a GP:
        // ----------------
        top->setVisible(false);

        middle->setText( _("Continue") );
        middle->setVisible(true);

        bottom->setText( _("Abort Grand Prix") );
        bottom->setVisible(true);

        middle->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
    }
    else
    {
        // Normal race
        // -----------

        middle->setText( _("Restart") );
        middle->setVisible(true);

        if (race_manager->raceWasStartedFromOverworld())
        {
            top->setVisible(false);
            bottom->setText( _("Back to challenge selection") );
        }
        else
        {
            top->setText( _("Setup New Race") );
            top->setVisible(true);
            bottom->setText( _("Back to the menu") );
        }
        bottom->setVisible(true);

        bottom->setFocusForPlayer(PLAYER_ID_GAME_MASTER);
    }
}   // enableAllButtons
Exemplo n.º 11
0
//-----------------------------------------------------------------------------
void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
                                  const std::string& name, const int playerID)
{

    // If something was unlocked, the 'continue' button was
    // actually used to display "Show unlocked feature(s)" text.
    // ---------------------------------------------------------
    int n = unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size();
    if(n>0)
    {
        if(name=="top")
        {
            if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
            {
                cleanupGPProgress();
            }

            std::vector<const ChallengeData*> unlocked =
                unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges();

            bool gameCompleted = false;
            for (unsigned int n = 0; n < unlocked.size(); n++)
            {
                if (unlocked[n]->getId() == "fortmagma")
                {
                    gameCompleted = true;
                    break;
                }
            }

            unlock_manager->getCurrentSlot()->clearUnlocked();

            if (gameCompleted)
            {
                // clear the race

                // kart will no longer be available during cutscene, drop reference
                StateManager::get()->getActivePlayer(playerID)->setKart(NULL);
                World::deleteWorld();

                StateManager::get()->enterGameState();
                race_manager->setMinorMode(RaceManager::MINOR_MODE_CUTSCENE);
                race_manager->setNumKarts( 0 );
                race_manager->setNumPlayers(0);
                race_manager->setNumLocalPlayers(0);
                race_manager->startSingleRace("endcutscene", 999, false);

                std::vector<std::string> parts;
                parts.push_back("endcutscene");
                ((CutsceneWorld*)World::getWorld())->setParts(parts);
            }
            else
            {
                FeatureUnlockedCutScene* scene =
                    FeatureUnlockedCutScene::getInstance();
                scene->addTrophy(race_manager->getDifficulty());
                scene->findWhatWasUnlocked(race_manager->getDifficulty());
                StateManager::get()->popMenu();
                World::deleteWorld();
                StateManager::get()->pushScreen(scene);
                race_manager->setAIKartOverride("");
            }
            return;
        }
        fprintf(stderr, "Incorrect event '%s' when things are unlocked.\n",
                name.c_str());
        assert(false);
    }

    // If we're playing online :
    if (World::getWorld()->isNetworkWorld())
    {
        StateManager::get()->popMenu();
        if (name == "middle") // Continue button (return to server lobby)
        {
            race_manager->exitRace();
            race_manager->setAIKartOverride("");
            Screen* newStack[] = {MainMenuScreen::getInstance(),
                                  OnlineScreen::getInstance(),
                                  ServerSelection::getInstance(),
                                  NetworkingLobby::getInstance(),
                                  NULL};
            StateManager::get()->resetAndSetStack( newStack );
        }
        if (name == "bottom") // Quit server (return to main menu)
        {
            race_manager->exitRace();
            race_manager->setAIKartOverride("");
            StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());
        }
        return;
    }

    // Next check for GP
    // -----------------
    if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX)
    {
        if (name == "middle")        // Next GP
        {
            cleanupGPProgress();
            StateManager::get()->popMenu();
            race_manager->next();
        }
        else if (name == "bottom")        // Abort
        {
            new MessageDialog(_("Do you really want to abort the Grand Prix?"),
                              MessageDialog::MESSAGE_DIALOG_CONFIRM, this, false);
        }
        else if (!getWidget(name.c_str())->isVisible())
        {
            fprintf(stderr, "Incorrect event '%s' when things are unlocked.\n",
                            name.c_str());
            assert(false);
        }
        return;
    }

    // This is a normal race, nothing was unlocked
    // -------------------------------------------
    StateManager::get()->popMenu();
    if(name=="top")                 // Setup new race
    {
        race_manager->exitRace();
        race_manager->setAIKartOverride("");
        NetworkKartSelectionScreen::getInstance()->tearDown(); // be sure to delete the kart selection screen
        Screen* newStack[] = {MainMenuScreen::getInstance(),
                              RaceSetupScreen::getInstance(),
                              NULL};
        StateManager::get()->resetAndSetStack( newStack );
    }
    else if (name=="middle")        // Restart
    {
        race_manager->rerunRace();
    }
    else if (name=="bottom")        // Back to main
    {
        race_manager->exitRace();
        race_manager->setAIKartOverride("");
        NetworkKartSelectionScreen::getInstance()->tearDown(); // be sure to delete the kart selection screen
        StateManager::get()->resetAndGoToScreen(MainMenuScreen::getInstance());

        if (race_manager->raceWasStartedFromOverworld())
        {
            OverWorld::enterOverWorld();
        }
    }
    else
    {
        fprintf(stderr, "Incorrect event '%s' for normal race.\n",
                name.c_str());
    }
    return;
}   // eventCallback
Exemplo n.º 12
0
    InventoryWindow::InventoryWindow(DragAndDrop* dragAndDrop)
        : WindowPinnableBase("openmw_inventory_window.layout")
        , mTrading(false)
        , mLastXSize(0)
        , mLastYSize(0)
        , mPreview(new MWRender::InventoryPreview(MWBase::Environment::get().getWorld ()->getPlayerPtr()))
        , mPreviewDirty(true)
        , mPreviewResize(true)
        , mDragAndDrop(dragAndDrop)
        , mSelectedItem(-1)
        , mGuiMode(GM_Inventory)
    {
        mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);

        getWidget(mAvatar, "Avatar");
        getWidget(mAvatarImage, "AvatarImage");
        getWidget(mEncumbranceBar, "EncumbranceBar");
        getWidget(mFilterAll, "AllButton");
        getWidget(mFilterWeapon, "WeaponButton");
        getWidget(mFilterApparel, "ApparelButton");
        getWidget(mFilterMagic, "MagicButton");
        getWidget(mFilterMisc, "MiscButton");
        getWidget(mLeftPane, "LeftPane");
        getWidget(mRightPane, "RightPane");
        getWidget(mArmorRating, "ArmorRating");

        mAvatarImage->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onAvatarClicked);

        getWidget(mItemView, "ItemView");
        mItemView->eventItemClicked += MyGUI::newDelegate(this, &InventoryWindow::onItemSelected);
        mItemView->eventBackgroundClicked += MyGUI::newDelegate(this, &InventoryWindow::onBackgroundSelected);

        mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterMagic->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterMisc->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);

        mFilterAll->setStateSelected(true);

        setGuiMode(mGuiMode);

        adjustPanes();
    }
Exemplo n.º 13
0
    InventoryWindow::InventoryWindow(DragAndDrop* dragAndDrop, osg::Group* parent, Resource::ResourceSystem* resourceSystem)
        : WindowPinnableBase("openmw_inventory_window.layout")
        , mDragAndDrop(dragAndDrop)
        , mSelectedItem(-1)
        , mSortModel(NULL)
        , mTradeModel(NULL)
        , mGuiMode(GM_Inventory)
        , mLastXSize(0)
        , mLastYSize(0)
        , mPreview(new MWRender::InventoryPreview(parent, resourceSystem, MWMechanics::getPlayer()))
        , mTrading(false)
    {
        mPreviewTexture.reset(new osgMyGUI::OSGTexture(mPreview->getTexture()));
        mPreview->rebuild();

        mMainWidget->castType<MyGUI::Window>()->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);

        getWidget(mAvatar, "Avatar");
        getWidget(mAvatarImage, "AvatarImage");
        getWidget(mEncumbranceBar, "EncumbranceBar");
        getWidget(mFilterAll, "AllButton");
        getWidget(mFilterWeapon, "WeaponButton");
        getWidget(mFilterApparel, "ApparelButton");
        getWidget(mFilterMagic, "MagicButton");
        getWidget(mFilterMisc, "MiscButton");
        getWidget(mLeftPane, "LeftPane");
        getWidget(mRightPane, "RightPane");
        getWidget(mArmorRating, "ArmorRating");

        mAvatarImage->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onAvatarClicked);
        mAvatarImage->setRenderItemTexture(mPreviewTexture.get());
        mAvatarImage->getSubWidgetMain()->_setUVSet(MyGUI::FloatRect(0.f, 0.f, 1.f, 1.f));

        getWidget(mItemView, "ItemView");
        mItemView->eventItemClicked += MyGUI::newDelegate(this, &InventoryWindow::onItemSelected);
        mItemView->eventBackgroundClicked += MyGUI::newDelegate(this, &InventoryWindow::onBackgroundSelected);

        mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterMagic->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterMisc->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);

        mFilterAll->setStateSelected(true);

        setGuiMode(mGuiMode);

        adjustPanes();
    }
Exemplo n.º 14
0
void Dock::show()
{
    getWidget().show();
}
Exemplo n.º 15
0
EnchantingDialog::EnchantingDialog()
    : WindowBase("openmw_enchanting_dialog.layout")
    , EffectEditorBase()
    , mItemSelectionDialog(NULL)
{
    getWidget(mName, "NameEdit");
    getWidget(mCancelButton, "CancelButton");
    getWidget(mAvailableEffectsList, "AvailableEffects");
    getWidget(mUsedEffectsView, "UsedEffects");
    getWidget(mItemBox, "ItemBox");
    getWidget(mSoulBox, "SoulBox");
    getWidget(mEnchantmentPoints, "Enchantment");
    getWidget(mCastCost, "CastCost");
    getWidget(mCharge, "Charge");
    getWidget(mTypeButton, "TypeButton");
    getWidget(mBuyButton, "BuyButton");
    getWidget(mPrice, "PriceLabel");
    getWidget(mPriceText, "PriceTextLabel");

    setWidgets(mAvailableEffectsList, mUsedEffectsView);

    mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onCancelButtonClicked);
    mItemBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectItem);
    mSoulBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectSoul);
    mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onBuyButtonClicked);
    mTypeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onTypeButtonClicked);
}
Exemplo n.º 16
0
void QtWebDirectory::raise() {
	QWidget * widget = (QWidget *) getWidget();
	widget->show();
	widget->raise();
}
Exemplo n.º 17
0
void selectWidget(const char *name, const char *group)
{
	selectedWidget = getWidget(name, group);
}
Exemplo n.º 18
0
void QtWebDirectory::init() {
	setUrl(WsUrl::getWengoDirectoryUrl());
	QWidget * widget = (QWidget *) getWidget();
	widget->setWindowTitle(tr("@product@ - Directory"));
}
Exemplo n.º 19
0
Arquivo: hud.cpp Projeto: ace13/openmw
    HUD::HUD(CustomMarkerCollection &customMarkers, bool showFps, DragAndDrop* dragAndDrop, MWRender::LocalMap* localMapRender)
        : Layout("openmw_hud.layout")
        , LocalMapBase(customMarkers, localMapRender)
        , mHealth(NULL)
        , mMagicka(NULL)
        , mStamina(NULL)
        , mDrowning(NULL)
        , mWeapImage(NULL)
        , mSpellImage(NULL)
        , mWeapStatus(NULL)
        , mSpellStatus(NULL)
        , mEffectBox(NULL)
        , mMinimap(NULL)
        , mCompass(NULL)
        , mCrosshair(NULL)
        , mCellNameBox(NULL)
        , mDrowningFrame(NULL)
        , mDrowningFlash(NULL)
        , mFpsBox(NULL)
        , mFpsCounter(NULL)
        , mHealthManaStaminaBaseLeft(0)
        , mWeapBoxBaseLeft(0)
        , mSpellBoxBaseLeft(0)
        , mMinimapBoxBaseRight(0)
        , mEffectBoxBaseRight(0)
        , mDragAndDrop(dragAndDrop)
        , mCellNameTimer(0.0f)
        , mWeaponSpellTimer(0.f)
        , mMapVisible(true)
        , mWeaponVisible(true)
        , mSpellVisible(true)
        , mWorldMouseOver(false)
        , mEnemyActorId(-1)
        , mEnemyHealthTimer(-1)
        , mIsDrowning(false)
        , mDrowningFlashTheta(0.f)
    {
        mMainWidget->setSize(MyGUI::RenderManager::getInstance().getViewSize());

        // Energy bars
        getWidget(mHealthFrame, "HealthFrame");
        getWidget(mHealth, "Health");
        getWidget(mMagicka, "Magicka");
        getWidget(mStamina, "Stamina");
        getWidget(mEnemyHealth, "EnemyHealth");
        mHealthManaStaminaBaseLeft = mHealthFrame->getLeft();

        MyGUI::Widget *healthFrame, *magickaFrame, *fatigueFrame;
        getWidget(healthFrame, "HealthFrame");
        getWidget(magickaFrame, "MagickaFrame");
        getWidget(fatigueFrame, "FatigueFrame");
        healthFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
        magickaFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);
        fatigueFrame->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onHMSClicked);

        //Drowning bar
        getWidget(mDrowningFrame, "DrowningFrame");
        getWidget(mDrowning, "Drowning");
        getWidget(mDrowningFlash, "Flash");
        mDrowning->setProgressRange(200);

        const MyGUI::IntSize& viewSize = MyGUI::RenderManager::getInstance().getViewSize();

        // Item and spell images and status bars
        getWidget(mWeapBox, "WeapBox");
        getWidget(mWeapImage, "WeapImage");
        getWidget(mWeapStatus, "WeapStatus");
        mWeapBoxBaseLeft = mWeapBox->getLeft();
        mWeapBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWeaponClicked);

        getWidget(mSpellBox, "SpellBox");
        getWidget(mSpellImage, "SpellImage");
        getWidget(mSpellStatus, "SpellStatus");
        mSpellBoxBaseLeft = mSpellBox->getLeft();
        mSpellBox->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMagicClicked);

        getWidget(mSneakBox, "SneakBox");
        mSneakBoxBaseLeft = mSneakBox->getLeft();

        getWidget(mEffectBox, "EffectBox");
        mEffectBoxBaseRight = viewSize.width - mEffectBox->getRight();

        getWidget(mMinimapBox, "MiniMapBox");
        mMinimapBoxBaseRight = viewSize.width - mMinimapBox->getRight();
        getWidget(mMinimap, "MiniMap");
        getWidget(mCompass, "Compass");
        getWidget(mMinimapButton, "MiniMapButton");
        mMinimapButton->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onMapClicked);

        getWidget(mCellNameBox, "CellName");
        getWidget(mWeaponSpellBox, "WeaponSpellName");

        getWidget(mCrosshair, "Crosshair");

        setFpsVisible(showFps);

        LocalMapBase::init(mMinimap, mCompass, Settings::Manager::getInt("local map hud widget size", "Map"));

        mMainWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &HUD::onWorldClicked);
        mMainWidget->eventMouseMove += MyGUI::newDelegate(this, &HUD::onWorldMouseOver);
        mMainWidget->eventMouseLostFocus += MyGUI::newDelegate(this, &HUD::onWorldMouseLostFocus);

        mSpellIcons = new SpellIcons();
    }
Exemplo n.º 20
0
    AlchemyWindow::AlchemyWindow(MWBase::WindowManager& parWindowManager)
        : WindowBase("openmw_alchemy_window.layout", parWindowManager)
        , ContainerBase(0), mApparatus (4), mIngredients (4)
    {
        getWidget(mCreateButton, "CreateButton");
        getWidget(mCancelButton, "CancelButton");
        getWidget(mIngredients[0], "Ingredient1");
        getWidget(mIngredients[1], "Ingredient2");
        getWidget(mIngredients[2], "Ingredient3");
        getWidget(mIngredients[3], "Ingredient4");
        getWidget(mApparatus[0], "Apparatus1");
        getWidget(mApparatus[1], "Apparatus2");
        getWidget(mApparatus[2], "Apparatus3");
        getWidget(mApparatus[3], "Apparatus4");
        getWidget(mEffectsBox, "CreatedEffects");
        getWidget(mNameEdit, "NameEdit");

        mIngredients[0]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);
        mIngredients[1]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);
        mIngredients[2]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);
        mIngredients[3]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);

        mCreateButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCreateButtonClicked);
        mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCancelButtonClicked);

        MyGUI::ScrollView* itemView;
        MyGUI::Widget* containerWidget;
        getWidget(containerWidget, "Items");
        getWidget(itemView, "ItemView");
        setWidgets(containerWidget, itemView);

        center();
    }
Exemplo n.º 21
0
    EditEffectDialog::EditEffectDialog()
        : WindowModal("openmw_edit_effect.layout")
        , mEditing(false)
        , mMagicEffect(NULL)
        , mConstantEffect(false)
    {
        init(mEffect);
        init(mOldEffect);

        getWidget(mCancelButton, "CancelButton");
        getWidget(mOkButton, "OkButton");
        getWidget(mDeleteButton, "DeleteButton");
        getWidget(mRangeButton, "RangeButton");
        getWidget(mMagnitudeMinValue, "MagnitudeMinValue");
        getWidget(mMagnitudeMaxValue, "MagnitudeMaxValue");
        getWidget(mDurationValue, "DurationValue");
        getWidget(mAreaValue, "AreaValue");
        getWidget(mMagnitudeMinSlider, "MagnitudeMinSlider");
        getWidget(mMagnitudeMaxSlider, "MagnitudeMaxSlider");
        getWidget(mDurationSlider, "DurationSlider");
        getWidget(mAreaSlider, "AreaSlider");
        getWidget(mEffectImage, "EffectImage");
        getWidget(mEffectName, "EffectName");
        getWidget(mAreaText, "AreaText");
        getWidget(mDurationBox, "DurationBox");
        getWidget(mAreaBox, "AreaBox");
        getWidget(mMagnitudeBox, "MagnitudeBox");

        mRangeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditEffectDialog::onRangeButtonClicked);
        mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditEffectDialog::onOkButtonClicked);
        mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditEffectDialog::onCancelButtonClicked);
        mDeleteButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EditEffectDialog::onDeleteButtonClicked);

        mMagnitudeMinSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &EditEffectDialog::onMagnitudeMinChanged);
        mMagnitudeMaxSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &EditEffectDialog::onMagnitudeMaxChanged);
        mDurationSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &EditEffectDialog::onDurationChanged);
        mAreaSlider->eventScrollChangePosition += MyGUI::newDelegate(this, &EditEffectDialog::onAreaChanged);
    }
Exemplo n.º 22
0
void initTitle(void)
{
	startSectionTransition();
	
	stopMusic();
	
	app.delegate.logic = &logic;
	app.delegate.draw = &draw;
	memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);
	
	battle.camera.x =  battle.camera.y = 0;
	
	destroyBattle();
	
	logo = getTexture("gfx/title/logo.png");
	
	pandoranWar = getTexture("gfx/title/pandoran.png");
	
	background = getTexture("gfx/backgrounds/background02.jpg");
	
	earthTexture = getTexture("gfx/planets/earth.png");
	
	earth.x = rand() % SCREEN_WIDTH;
	earth.y = -(128 + (rand() % 128));
	
	initBackground();
	
	initEffects();
	
	initFighters();
	
	updateAllMissions();
	
	getWidget("campaign", "title")->action = campaign;
	getWidget("challenges", "title")->action = challenges;
	getWidget("trophies", "title")->action = trophies;
	getWidget("stats", "title")->action = stats;
	getWidget("fighterDB", "title")->action = fighterDatabase;
	getWidget("options", "title")->action = options;
	getWidget("credits", "title")->action = credits;
	getWidget("quit", "title")->action = quit;
	
	getWidget("ok", "stats")->action = ok;
	getWidget("ok", "trophies")->action = ok;
	getWidget("ok", "fighterDB")->action = ok;
	
	show = SHOW_TITLE;
	
	endSectionTransition();
	
	playMusic("music/main/Rise of spirit.ogg", 0);
}
Exemplo n.º 23
0
    AlchemyWindow::AlchemyWindow()
        : WindowBase("openmw_alchemy_window.layout")
        , mSortModel(NULL)
        , mAlchemy(new MWMechanics::Alchemy())
        , mApparatus (4)
        , mIngredients (4)
    {
        getWidget(mCreateButton, "CreateButton");
        getWidget(mCancelButton, "CancelButton");
        getWidget(mIngredients[0], "Ingredient1");
        getWidget(mIngredients[1], "Ingredient2");
        getWidget(mIngredients[2], "Ingredient3");
        getWidget(mIngredients[3], "Ingredient4");
        getWidget(mApparatus[0], "Apparatus1");
        getWidget(mApparatus[1], "Apparatus2");
        getWidget(mApparatus[2], "Apparatus3");
        getWidget(mApparatus[3], "Apparatus4");
        getWidget(mEffectsBox, "CreatedEffects");
        getWidget(mNameEdit, "NameEdit");
        getWidget(mItemView, "ItemView");


        mItemView->eventItemClicked += MyGUI::newDelegate(this, &AlchemyWindow::onSelectedItem);

        mIngredients[0]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);
        mIngredients[1]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);
        mIngredients[2]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);
        mIngredients[3]->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onIngredientSelected);

        mCreateButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCreateButtonClicked);
        mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &AlchemyWindow::onCancelButtonClicked);

        center();
    }
Exemplo n.º 24
0
    InventoryWindow::InventoryWindow(MWBase::WindowManager& parWindowManager,DragAndDrop* dragAndDrop)
        : ContainerBase(dragAndDrop)
        , WindowPinnableBase("openmw_inventory_window.layout", parWindowManager)
        , mTrading(false)
        , mLastXSize(0)
        , mLastYSize(0)
        , mPreview(MWBase::Environment::get().getWorld ()->getPlayer ().getPlayer ())
    {
        static_cast<MyGUI::Window*>(mMainWidget)->eventWindowChangeCoord += MyGUI::newDelegate(this, &InventoryWindow::onWindowResize);

        getWidget(mAvatar, "Avatar");
        getWidget(mAvatarImage, "AvatarImage");
        getWidget(mEncumbranceBar, "EncumbranceBar");
        getWidget(mEncumbranceText, "EncumbranceBarT");
        getWidget(mFilterAll, "AllButton");
        getWidget(mFilterWeapon, "WeaponButton");
        getWidget(mFilterApparel, "ApparelButton");
        getWidget(mFilterMagic, "MagicButton");
        getWidget(mFilterMisc, "MiscButton");
        getWidget(mLeftPane, "LeftPane");
        getWidget(mRightPane, "RightPane");

        mAvatar->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onAvatarClicked);

        MyGUI::ScrollView* itemView;
        MyGUI::Widget* containerWidget;
        getWidget(containerWidget, "Items");
        getWidget(itemView, "ItemView");
        setWidgets(containerWidget, itemView);

        mFilterAll->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterWeapon->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterApparel->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterMagic->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);
        mFilterMisc->eventMouseButtonClick += MyGUI::newDelegate(this, &InventoryWindow::onFilterChanged);

        mFilterAll->setStateSelected(true);

        setCoord(0, 342, 498, 258);

        mPreview.setup();

        MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayer().getPlayer();
        openContainer(player);
    }
Exemplo n.º 25
0
bool GUI::hasWidget(const Common::UString &tag) const {
	return getWidget(tag) != 0;
}
Exemplo n.º 26
0
void initChallengeHome(void)
{
	Mission *m;
	
	startSectionTransition();

	stopMusic();

	updateAllMissions();

	unlockChallenges();

	awardChallengeTrophies();

	awardStatsTrophies();

	app.saveGame = 1;
	
	CHALLENGES_TEXT = _("Challenges");
	COMPLETED_TEXT = _("Completed : %d / %d");
	PAGE_TEXT = _("Page : %d / %d");
	LOCKED_TEXT = _("[Locked]");
	CRAFT_TEXT = _("Craft: %s");
	TIME_TEXT = _("Time Limit: %s");
	RESTRICTIONS_TEXT = _("Restrictions: %s");

	app.delegate.logic = &logic;
	app.delegate.draw = &draw;
	memset(&app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS);

	background = getTexture(getBackgroundTextureName(rand()));
	planetTexture = getTexture(getPlanetTextureName(rand()));
	challengeIcon = getTexture("gfx/challenges/challengeIcon.png");
	challengeIconHighlight = getTexture("gfx/challenges/challengeIconHighlight.png");

	battle.camera.x =  battle.camera.y = 0;

	planet.x = rand() % SCREEN_WIDTH;
	planet.y = rand() % SCREEN_HEIGHT;
	
	maxPages = page = 0;
	
	for (m = game.challengeMissionHead.next ; m != NULL ; m = m->next)
	{
		maxPages++;
	}
	
	maxPages /= CHALLENGES_PER_PAGE;
	maxPages = ceil(maxPages);

	show = SHOW_CHALLENGES;

	initBackground();

	start = getWidget("start", "challenges");
	start->action = startChallengeMission;

	getWidget("resume", "challengesMenu")->action = resume;
	getWidget("stats", "challengesMenu")->action = stats;
	getWidget("trophies", "challengesMenu")->action = trophies;
	getWidget("fighterDB", "challengesMenu")->action = fighterDatabase;
	getWidget("options", "challengesMenu")->action = options;
	getWidget("quit", "challengesMenu")->action = quit;

	getWidget("ok", "stats")->action = ok;
	getWidget("ok", "trophies")->action = ok;
	getWidget("ok", "fighterDB")->action = ok;
	
	prev = getWidget("prev", "challenges");
	prev->action = prevPage;
	prev->visible = 0;
	
	next = getWidget("next", "challenges");
	next->action = nextPage;
	next->visible = 1;

	/* select first challenge if none chosen */
	if (!game.currentMission)
	{
		game.currentMission = game.challengeMissionHead.next;
		updateChallengeMissionData();
	}
	
	SDL_SetWindowGrab(app.window, 0);

	endSectionTransition();

	playMusic("music/main/covert_operations.mp3", 1);
}
Exemplo n.º 27
0
 virtual void show() { getWidget()->show(); };
Exemplo n.º 28
0
void HUD::update(int width, int height) {
	std::set<Resolution> availableRes;

	for (size_t i = 0; i < ARRAYSIZE(kResolution); i++)
		if (ResMan.hasResource(kResolution[i].gui, Aurora::kFileTypeGUI))
			availableRes.insert(kResolution[i]);

	const int wWidth  = width;
	const int wHeight = height;

	const Resolution *foundRes = 0;
	for (std::set<Resolution>::const_iterator it = availableRes.begin(); it != availableRes.end(); ++it)
		if (it->width == wWidth && it->height == wHeight)
			foundRes = &*it;

	bool scale = false;
	if (!foundRes) {
		for (std::set<Resolution>::const_iterator it = availableRes.begin(); it != availableRes.end(); ++it) {
			if ((it->width == 800) && (it->height == 600)) {
				foundRes = &*it;
				break;
			}
		}
		if (!foundRes)
			throw Common::Exception("No gui with 800x600 resolution found.");
		scale = true;
	}

	load(foundRes->gui);

	// Make all the widgets invisible and scale them if needed.
	for (size_t i = 0; i < ARRAYSIZE(kKnownWidgets); i++) {
		Widget *widget = getWidget(kKnownWidgets[i].name);
		if (!widget)
			continue;

		widget->setInvisible(!kKnownWidgets[i].visible);

		float x, y, z;
		if (scale) {
			switch (kKnownWidgets[i].position) {
				case kPositionUpperLeft:
					widget->getPosition(x, y, z);
					widget->setPosition(-wWidth/2 + (400 + x), wHeight/2 - (300 - y), z);
					break;
				case kPositionUpperRight:
					widget->getPosition(x, y, z);
					widget->setPosition(wWidth/2 - (400 - x), wHeight/2 - (300 - y), z);
					break;
				case kPositionUpperMid:
					widget->getPosition(x, y, z);
					widget->setPosition(x, wHeight/2 - (300 - y), z);
					break;
				case kPositionLowerLeft:
					widget->getPosition(x, y, z);
					widget->setPosition(-wWidth/2 + (400 + x), -wHeight/2 + (300 + y), z);
					break;
				case kPositionLowerRight:
					widget->getPosition(x, y, z);
					widget->setPosition(wWidth/2 - (400 - x), -wHeight/2 + (300 + y), z);
					break;
				case kPositionLowerMid:
					widget->getPosition(x, y, z);
					widget->setPosition(x, -wHeight/2 + (300 + y), z);
					break;
				default:
					break;
			}
		}
	}
}
Exemplo n.º 29
0
    InteractiveMessageBox::InteractiveMessageBox(MessageBoxManager& parMessageBoxManager, const std::string& message, const std::vector<std::string>& buttons)
        : WindowModal("openmw_interactive_messagebox.layout")
      , mMessageBoxManager(parMessageBoxManager)
      , mButtonPressed(-1)
        , mTextButtonPadding(0)
    {
        WindowModal::open();

        int fixedWidth = 500;
        int textPadding = 10; // padding between text-widget and main-widget
        int textButtonPadding = 20; // padding between the text-widget und the button-widget
        int buttonLeftPadding = 10; // padding between the buttons if horizontal
        int buttonTopPadding = 5; // ^-- if vertical
        int buttonPadding = 5; // padding between button label and button itself
        int buttonMainPadding = 10; // padding between buttons and bottom of the main widget

        mMarkedToDelete = false;


        getWidget(mMessageWidget, "message");
        getWidget(mButtonsWidget, "buttons");

        mMessageWidget->setOverflowToTheLeft(true);
        mMessageWidget->setCaptionWithReplacing(message);

        MyGUI::IntSize textSize = mMessageWidget->getTextSize();

        MyGUI::IntSize gameWindowSize = MyGUI::RenderManager::getInstance().getViewSize();

        int biggestButtonWidth = 0;
        int buttonWidth = 0;
        int buttonsWidth = 0;
        int buttonHeight = 0;
        MyGUI::IntCoord dummyCoord(0, 0, 0, 0);

        std::vector<std::string>::const_iterator it;
        for(it = buttons.begin(); it != buttons.end(); ++it)
        {
            MyGUI::Button* button = mButtonsWidget->createWidget<MyGUI::Button>(
                MyGUI::WidgetStyle::Child,
                std::string("MW_Button"),
                dummyCoord,
                MyGUI::Align::Default);
            button->setCaptionWithReplacing(*it);

            button->eventMouseButtonClick += MyGUI::newDelegate(this, &InteractiveMessageBox::mousePressed);

            mButtons.push_back(button);

            buttonWidth = button->getTextSize().width + 2*buttonPadding + buttonLeftPadding;
            buttonsWidth += buttonWidth;
            buttonHeight = button->getTextSize().height + 2*buttonPadding + buttonTopPadding;

            if(buttonWidth > biggestButtonWidth)
            {
                biggestButtonWidth = buttonWidth;
            }
        }
        buttonsWidth += buttonLeftPadding;

        MyGUI::IntSize mainWidgetSize;
        if(buttonsWidth < fixedWidth)
        {
            // on one line
            if(textSize.width + 2*textPadding < buttonsWidth)
            {
                mainWidgetSize.width = buttonsWidth;
            }
            else
            {
                mainWidgetSize.width = textSize.width + 3*textPadding;
            }
            mainWidgetSize.height = textSize.height + textButtonPadding + buttonHeight + buttonMainPadding;

            MyGUI::IntCoord absCoord;
            absCoord.left = (gameWindowSize.width - mainWidgetSize.width)/2;
            absCoord.top = (gameWindowSize.height - mainWidgetSize.height)/2;

            mMainWidget->setCoord(absCoord);
            mMainWidget->setSize(mainWidgetSize);

            MyGUI::IntCoord messageWidgetCoord;
            messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
            messageWidgetCoord.top = textPadding;
            mMessageWidget->setCoord(messageWidgetCoord);

            mMessageWidget->setSize(textSize);

            MyGUI::IntCoord buttonCord;
            MyGUI::IntSize buttonSize(0, buttonHeight);
            int left = (mainWidgetSize.width - buttonsWidth)/2 + buttonPadding;

            std::vector<MyGUI::Button*>::const_iterator button;
            for(button = mButtons.begin(); button != mButtons.end(); ++button)
            {
                buttonCord.left = left;
                buttonCord.top = textSize.height + textButtonPadding;

                buttonSize.width = (*button)->getTextSize().width + 2*buttonPadding;
                buttonSize.height = (*button)->getTextSize().height + 2*buttonPadding;

                (*button)->setCoord(buttonCord);
                (*button)->setSize(buttonSize);

                left += buttonSize.width + buttonLeftPadding;
            }
        }
        else
        {
            // among each other
            if(biggestButtonWidth > textSize.width) {
                mainWidgetSize.width = biggestButtonWidth + buttonTopPadding;
            }
            else {
                mainWidgetSize.width = textSize.width + 3*textPadding;
            }
            mainWidgetSize.height = textSize.height + 2*textPadding + textButtonPadding + buttonHeight * buttons.size() + buttonMainPadding;

            mMainWidget->setSize(mainWidgetSize);

            MyGUI::IntCoord absCoord;
            absCoord.left = (gameWindowSize.width - mainWidgetSize.width)/2;
            absCoord.top = (gameWindowSize.height - mainWidgetSize.height)/2;

            mMainWidget->setCoord(absCoord);
            mMainWidget->setSize(mainWidgetSize);


            MyGUI::IntCoord messageWidgetCoord;
            messageWidgetCoord.left = (mainWidgetSize.width - textSize.width)/2;
            messageWidgetCoord.top = textPadding;
            mMessageWidget->setCoord(messageWidgetCoord);

            mMessageWidget->setSize(textSize);

            MyGUI::IntCoord buttonCord;
            MyGUI::IntSize buttonSize(0, buttonHeight);

            int top = textButtonPadding + buttonTopPadding + textSize.height;

            std::vector<MyGUI::Button*>::const_iterator button;
            for(button = mButtons.begin(); button != mButtons.end(); ++button)
            {
                buttonSize.width = (*button)->getTextSize().width + buttonPadding*2;
                buttonSize.height = (*button)->getTextSize().height + buttonPadding*2;

                buttonCord.top = top;
                buttonCord.left = (mainWidgetSize.width - buttonSize.width)/2 - 5; // FIXME: -5 is not so nice :/

                (*button)->setCoord(buttonCord);
                (*button)->setSize(buttonSize);

                top += buttonSize.height + 2*buttonTopPadding;
            }

        }

        // Set key focus to "Ok" button
        std::string ok = Misc::StringUtils::lowerCase(MyGUI::LanguageManager::getInstance().replaceTags("#{sOK}"));
        std::vector<MyGUI::Button*>::const_iterator button;
        for(button = mButtons.begin(); button != mButtons.end(); ++button)
        {
            if(Misc::StringUtils::ciEqual((*button)->getCaption(), ok))
            {
                MyGUI::InputManager::getInstance().setKeyFocusWidget(*button);
                (*button)->eventKeyButtonPressed += MyGUI::newDelegate(this, &InteractiveMessageBox::onKeyPressed);
                break;
            }
        }
    }
Exemplo n.º 30
0
Gtk::Paned *Dock::getParentPaned()
{
    g_return_val_if_fail(_dock_box, 0);
    Gtk::Container *parent = getWidget().get_parent();
    return (parent != 0 ? dynamic_cast<Gtk::Paned *>(parent) : 0);
}