Esempio n. 1
0
    CProgress(IrrlichtDevice *pDevice) {
      m_pDevice=pDevice;
      m_pDriver=pDevice->getVideoDriver();
      m_pGuienv=pDevice->getGUIEnvironment();

      //let's add a "please stand by" image filling the complete window / screen
      core::dimension2du cScreenSize=m_pDevice->getVideoDriver()->getScreenSize();

      m_pImg=m_pGuienv->addImage(core::rect<s32>(0,0,cScreenSize.Width,cScreenSize.Height));
      m_pImg->setScaleImage(true);
      m_pImg->setImage(m_pDriver->getTexture(DATADIR "/textures/standby.png"));

      m_pBar=new CProgressBar(m_pGuienv,core::rect<s32>(core::position2di(cScreenSize.Width/2-150,cScreenSize.Height-60),core::dimension2di(300,30)),-1,NULL);
      m_pText=m_pGuienv->addStaticText(L"",core::rect<s32>(core::position2di(cScreenSize.Width/2-150,cScreenSize.Height-60),core::dimension2di(300,30)),true);
      m_pText->setBackgroundColor(video::SColor(192,192,192,192));
      m_pText->setDrawBackground(true);
      m_pText->setTextAlignment(gui::EGUIA_CENTER,gui::EGUIA_CENTER);

      ode::CIrrOdeManager::getSharedInstance()->getIrrThread()->getInputQueue()->addEventListener(this);
    }
Esempio n. 2
0
 /** Init the message text, do linebreak as required. */
 void init()
 {
     const GUIEngine::BoxRenderParams &brp =
         GUIEngine::getSkin()->getBoxRenderParams(m_render_type);
     const unsigned width = irr_driver->getActualScreenSize().Width;
     const unsigned height = irr_driver->getActualScreenSize().Height;
     const unsigned max_width = width - (brp.m_left_border +
         brp.m_right_border);
     m_text =
         GUIEngine::getGUIEnv()->addStaticText(m_message.c_str(),
         core::recti(0, 0, max_width, height));
     m_text->setRightToLeft(translations->isRTLText(m_message));
     core::dimension2du dim(m_text->getTextWidth(),
         m_text->getTextHeight());
     dim.Width += brp.m_left_border + brp.m_right_border;
     int x = (width - dim.Width) / 2;
     int y = height - int(1.5f * dim.Height);
     g_area = irr::core::recti(x, y, x + dim.Width, y + dim.Height);
     m_text->setRelativePosition(g_area);
     m_text->setTextAlignment(gui::EGUIA_CENTER, gui::EGUIA_CENTER);
     m_text->grab();
     m_text->remove();
 }