Пример #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);
            }
        }
    }
Пример #2
0
//------------------------------------------------------------------------------
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);
}
Пример #3
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);
	}
Пример #4
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);
    }