Exemple #1
0
    void DiInfo::Update(float delta)
    {
        //Change("FPS", 1.0f / delta);

        if (mInfo != nullptr)
        {
            //std::ostringstream stream;
            //for (MyGUI::VectorStringPairs::iterator iter = mParams.begin(); iter != mParams.end(); ++iter)
            //{
            //    if (iter != mParams.begin())
            //        stream << "\n";
            //    stream << iter->first << " :\t" << iter->second;
            //}

            //mInfo->setCaption(stream.str());
            DiString info = DiProfiler::GetInstancePtr()->GetData();
            DiString fps;
            fps.Format("\nFPS: %f", 1.0f / delta);
            info += fps;
            mInfo->setCaption(info.c_str());

            DI_PROFILE_BEGIN_INTERVAL

            MyGUI::ISubWidgetText* text = mInfo->getSubWidgetText();
            if (text != nullptr)
            {
                const MyGUI::IntSize& size = text->getTextSize() + mInfo->getSize() - text->getSize();
                const MyGUI::IntSize& size_view = MyGUI::RenderManager::getInstance().getViewSize();
                mInfo->setCoord(10, 10, size.width, size.height);
            }
        }
    }
Exemple #2
0
	ToolTip::ToolTip() :
		BaseLayout("ToolTip.layout")
	{
		assignWidget(mTextName, "text_Name");
		assignWidget(mTextCount, "text_Count");
		assignWidget(mTextDesc, "text_Desc");
		assignWidget(mImageInfo, "image_Info");

		MyGUI::ISubWidgetText* text = mTextDesc->getSubWidgetText();
		const MyGUI::IntCoord& coord = text ? text->getCoord() : MyGUI::IntCoord();
		mOffsetHeight = mMainWidget->getHeight() - coord.height;
	}
//------------------------------------------------------------------------------
void MyguiConsoleUI::setCwd(const std::string& cwd) {
  mwCwd->setCaption(cwd);
  // resize cwd and cmd
  MyGUI::ISubWidgetText* text = mwCwd->getSubWidgetText();

  const MyGUI::IntSize size(text->getTextSize().width, mwCwd->getSize().height);
  mwCwd->setSize(size);

  const MyGUI::IntSize& size_view =
      MyGUI::RenderManager::getInstance().getViewSize();
  mwCmd->setPosition(
      mwCwd->getPosition().left + size.width, mwCmd->getPosition().top);
  mwCmd->setSize(
      size_view.width - mwCwd->getSize().width, mwCmd->getSize().height);
}
Exemple #4
0
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
{
    MyGUI::ISubWidgetText* t = mHistory->getClient()->getSubWidgetText();
    if(t == nullptr)
        return;

    const MyGUI::IntPoint& lastPressed = MyGUI::InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);

    size_t cursorPosition = t->getCursorPosition(lastPressed);
    MyGUI::UString color = mHistory->getColorAtPos(cursorPosition);

    if (!mEnabled && color == "#572D21")
        MWBase::Environment::get().getDialogueManager()->goodbyeSelected();

    if(color != "#B29154")
    {
        MyGUI::UString key = mHistory->getColorTextAt(cursorPosition);

        if(color == "#686EBA")
        {
            std::map<size_t, HyperLink>::iterator i = mHyperLinks.upper_bound(cursorPosition);
            if( !mHyperLinks.empty() )
            {
                --i;

                if( i->first + i->second.mLength > cursorPosition)
                {
                    MWBase::Environment::get().getDialogueManager()->keywordSelected(i->second.mTrueValue);
                }
            }
            else
            {
                // the link was colored, but it is not in  mHyperLinks.
                // It means that those liunks are not marked with @# and found
                // by topic name search
                MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(key));
            }
        }

        if(color == "#572D21")
            MWBase::Environment::get().getDialogueManager()->questionAnswered(lower_string(key));
    }
}
Exemple #5
0
	void ToolTip::show(ItemData* _data)
	{
		if ((_data == nullptr) || _data->isEmpty())
			return;

		mTextCount->setCaption(MyGUI::utility::toString(_data->getCount()));
		mTextName->setCaption(_data->getInfo()->getItemName());
		mTextDesc->setCaption(_data->getInfo()->getItemDescription());
		if (!_data->isEmpty())
		{
			mImageInfo->setItemResourceInfo(_data->getImage(), "ToolTip", "Normal");
		}

		// вычисляем размер
		MyGUI::ISubWidgetText* text = mTextDesc->getSubWidgetText();
		const MyGUI::IntSize& text_size = text ? text->getTextSize() : MyGUI::IntSize();
		mMainWidget->setSize(mMainWidget->getWidth(), mOffsetHeight + text_size.height);

		mMainWidget->setVisible(true);
	}
Exemple #6
0
	void ToolTip::show(const std::string& data, const MyGUI::IntPoint& _point)
	{
		if (data.empty())
			return;
        
        mText->setCaption(data);
        
		MyGUI::ISubWidgetText* text = mText->getSubWidgetText();
		MyGUI::IntSize text_size = text ? text->getTextSize() : MyGUI::IntSize();

		mText->setSize(text_size);
        
        text_size.width += 8;
        text_size.height += 8;
        
		mWrap->setSize(text_size);
        
		mWrap->setVisible(true);
        move(_point);
    }
Exemple #7
0
void DialogueWindow::onHistoryClicked(MyGUI::Widget* _sender)
{
    MyGUI::ISubWidgetText* t = mHistory->getClient()->getSubWidgetText();
    if(t == nullptr)
        return;

    const MyGUI::IntPoint& lastPressed = MyGUI::InputManager::getInstance().getLastPressedPosition(MyGUI::MouseButton::Left);

    size_t cursorPosition = t->getCursorPosition(lastPressed);
    MyGUI::UString color = mHistory->getColorAtPos(cursorPosition);

    if (!mEnabled && color == "#572D21")
        MWBase::Environment::get().getDialogueManager()->goodbyeSelected();

    if(color != "#B29154")
    {
        MyGUI::UString key = mHistory->getColorTextAt(cursorPosition);
        if(color == "#686EBA") MWBase::Environment::get().getDialogueManager()->keywordSelected(lower_string(key));

        if(color == "#572D21") MWBase::Environment::get().getDialogueManager()->questionAnswered(lower_string(key));
    }
}