Desktop::Desktop(ViewLogicGame& owner, IrrlichtDevice* pDevice) : IGUIElement(EGUIET_ELEMENT, pDevice->getGUIEnvironment(), pDevice->getGUIEnvironment()->getRootGUIElement(), -1, core::rect<s32>(0, 0, 0, 0)) , m_owner(owner) , m_pDevice(pDevice) , m_pAppBar(NULL) , m_pFontCourier(NULL) , m_mutexApps(true) , m_pSoftwareMgr(NULL) , m_pItemMgr(NULL) { #ifdef _DEBUG setDebugName("Desktop"); #endif//_DEBUG // set the desktop dimensions core::dimension2d<s32> screenRes = pDevice->getVideoDriver()->getScreenSize(); AbsoluteRect = core::rect<s32>(0, 0, screenRes.Width, screenRes.Height); AbsoluteClippingRect = AbsoluteRect; // load the desktop graphic and scale it as the wallpaper IImage* pImg = m_pDevice->getVideoDriver()->createImageFromFile("./clientdata/desktop.jpg"); IImage* pImg2 = m_pDevice->getVideoDriver()->createImage(pImg->getColorFormat(), screenRes); pImg->copyToScaling( pImg2 ); pImg->drop(); m_pBackground = m_pDevice->getVideoDriver()->addTexture("desktop", pImg2); pImg2->drop(); // create the font(s) m_pFontCourier = m_pDevice->getGUIEnvironment()->getFont("./clientdata/fonts/fontcourier.png"); // create the desktop app bar m_pAppBar = new DesktopAppBar(Environment, this); }
//--------------------------------------------------------------------------------------- //Converte uma textura para o tamanho da tela, partindo do que seria 800x600 video::ITexture* Interface::LeTexturaConvertida(const c8 *filename) { IImage *temp = central->Device()->getVideoDriver()->createImageFromFile(filename); if (temp == NULL) return NULL; //deu pau core::dimension2di tamanhoOriginal = temp->getDimension(); //calculo qual deveria ser o tamanho core::dimension2di novoTamanho(ConverteX(tamanhoOriginal.Width), ConverteY(tamanhoOriginal.Height)); ITexture* buf = central->Device()->getVideoDriver()->addTexture(novoTamanho, "Texture"); IImage *nova = central->Device()->getVideoDriver()->createImageFromData(temp->getColorFormat(), novoTamanho, buf->lock()); buf->unlock(); temp->copyToScaling(nova); ITexture *retorno = central->Device()->getVideoDriver()->addTexture(filename, nova); nova->drop(); //free(buffer); return retorno; }