CEGUI 动态生成 texture imageset image
2011-01-05 21:13
295 查看
CEGUI 动态生成 texture imageset image
2010-05-13 13:22
转自http://hi.baidu.com/wither/blog/item/9e67991339d97b8c6438db4e.html
2010-05-13 13:22
unsigned long* CMD_GUI_GetSmallMapBuf() // render small map { DWORD color[6] = { D3DCOLOR_RGBA( 0, 0, 255, 255 ), D3DCOLOR_RGBA( 255 , 0, 255, 255 ), D3DCOLOR_RGBA( 0, 255, 255, 255 ), D3DCOLOR_RGBA( 0, 255, 0, 255 ), D3DCOLOR_RGBA( 255, 255, 0, 255 ), D3DCOLOR_RGBA( 255, 0, 0, 255 ) }; int i = 0; int j = 0; static DWORD dwSmallMap[200][200]; for(i=0; i<200; i++) { for(j=0; j<200; j++) { dwSmallMap[i][j] = color[ CMD_SIM_GetMapUnit(i,j) ]; } } CEGUI::Size size(200, 200); CEGUI::Point pxy(0, 0); CEGUI::Texture* tex = ( &CEGUI::System::getSingleton().getRenderer()->createTexture(size) ); tex->loadFromMemory((void*)dwSmallMap, size, CEGUI::Texture::PF_RGBA); CEGUI::ImagesetManager* ImgSetMgr = &CEGUI::ImagesetManager::getSingleton(); ImgSetMgr->create("SmallMap", *tex,CEGUI::XMLResourceExistsAction::XREA_REPLACE); CEGUI::Window* pwnd = CMD_GUI_GetWindowByName("MessageBox.layout"); CEGUI::Imageset* ImgSet = &ImgSetMgr->get("SmallMap"); ImgSet->defineImage("_full_image_", pxy, size, pxy); pwnd->getChild("MSG/background")->setProperty("Image", "set:SmallMap image:_full_image_"); return NULL; } ===== void CMD_GUI_ResetSmallMap() { int x = (int)gRSRenderer->GetCameraCenter()->x; int y = (int)gRSRenderer->GetCameraCenter()->y; int i = 0; int j = 0; for(i=0; i<200; i++) { for(j=0; j<200; j++) { //if( abs(x-i)<10 && abs(y-j)<10 ) //rectangle small map if( pow( (float)(x-i)*(x-i) + (y-j)*(y-j), 0.5f) < 10 ) //circle small map dwSmallMap[i][j] = color_now[ CMD_SIM_GetMapUnit(i,j) ]; else dwSmallMap[i][j] = color[ CMD_SIM_GetMapUnit(i,j) ]; } } CEGUI::Size size(200, 200); CEGUI::Point pxy(0, 0); CEGUI::Texture* tex = ( &CEGUI::System::getSingleton().getRenderer()->createTexture(size) ); tex->loadFromMemory((void*)dwSmallMap, size, CEGUI::Texture::PF_RGBA); CEGUI::ImagesetManager& ImgSetMgr = CEGUI::ImagesetManager::getSingleton(); ImgSetMgr.create("SmallMap", *tex, (CEGUI::XMLResourceExistsAction)1); //1 == CEGUI::XMLResourceExistsAction::XREA_REPLACE; CEGUI::Window* pwnd = CMD_GUI_GetWindowByName("MYGameWindow.layout"); CEGUI::Imageset* ImgSet = &ImgSetMgr.get("SmallMap"); ImgSet->defineImage("_full_image_", pxy, size, pxy); pwnd = pwnd->getChild("MYGameWindow/Frame"); pwnd = pwnd->getChild("MYGameWindow/SmallMap"); pwnd->setProperty("Image", "set:SmallMap image:_full_image_"); return ; } void CMD_GUI_DrawHeroFace() { MYTexture* gtex = gRSRenderer->GetHeroFaceTexture(); if(NULL == gtex) return; CEGUI::Size size(MC_CHARACTER_PORTRAIT_SIZE, MC_CHARACTER_PORTRAIT_SIZE); CEGUI::Point pxy(0, 0); CEGUI::Texture* ctex = ( &CEGUI::System::getSingleton().getRenderer()->createTexture(size) ); ((CEGUI::Direct3D9Texture*)ctex)->setDirect3D9Texture( (LPDIRECT3DTEXTURE9)gtex->pData ); CEGUI::ImagesetManager& ImgSetMgr = CEGUI::ImagesetManager::getSingleton(); ImgSetMgr.create("HeroFace", *ctex, (CEGUI::XMLResourceExistsAction)1); //1 == CEGUI::XMLResourceExistsAction::XREA_REPLACE; CEGUI::Imageset* ImgSet = &ImgSetMgr.get("HeroFace"); ImgSet->defineImage("_full_image_", pxy, size, pxy); CEGUI::Window* pwnd = CMD_GUI_GetWindowByName("MYGameWindow.layout"); pwnd = pwnd->getChild("MYGameWindow/Hero"); pwnd = pwnd->getChild("MYGameWindow/Hero/Face"); pwnd->setProperty("Image", "set:HeroFace image:_full_image_"); } |
相关文章推荐
- CEGUI 动态生成 texture imageset image
- CEGUI 动态生成 texture imageset image
- CEGUI 动态生成 texture imageset image
- winphone动态生成textBlock、image等控件
- convert_imageset.exe的生成
- 使用CEGUI的imagesets下的OgreTray.imageset的MouseArrow
- CEGUI TEXTURE 获取 imageset里 image的像素
- nginx利用image_filter动态生成缩略图
- nginx利用image_filter动态生成缩略图
- android 动态添加ImageView 设置setPadding不起作用问
- 动态添加ImageView 设置setPadding不起作用问题
- 圆形ImageView且设置动态生成的image
- 动态setImageResource后setPadding无效不起作用的处理办法
- cegui动态生成字体
- 动态添加ImageView 设置setPadding不起作用问题
- cegui imageset uieditor的见鬼问题
- nginx利用image_filter动态生成缩略图
- 解决nginx利用image_filter动态生成缩略图不支持bmp
- 动态添加ImageView 设置setPadding不起作用问题
- 小程序动态生成二维码,生成image图片