
If you are not aware of jsLINB see their WYSIWYG builder in action http://www.linb.net/VisualJS/UIBuilder.html
looks are fully customizable, you can pretty much make new theme for each dialog.
Code: Select all
_texture = TEXMGR.createManual(
"GUIOverlayTexture",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
Ogre::TEX_TYPE_2D,
app.viewport->getActualWidth(),
app.viewport->getActualHeight(),
0,
Ogre::PF_BYTE_BGRA,
Ogre::TU_DYNAMIC_WRITE_ONLY_DISCARDABLE
);
// Create a material using the texture
_material = MTRLMGR.create("GUIOverlayTextureMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
_material->getTechnique(0)->getPass(0)->createTextureUnitState("GUIOverlayTexture");
_material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
// Create a panel
_panel = static_cast<OverlayContainer*>(OVERLAYMGR.createOverlayElement("Panel", "GUIOverlayPanel"));
_panel->setMetricsMode(Ogre::GMM_PIXELS);
_panel->setPosition(0, 0);
_panel->setDimensions(app.viewport->getActualWidth(), app.viewport->getActualHeight());
_panel->setMaterialName("GUIOverlayTextureMaterial");
// Create an overlay, and add the panel
_overlay = OVERLAYMGR.create("GUIOverlay");
_overlay->add2D(_panel);
// Show the overlay
_overlay->show();
Code: Select all
// Get the pixel buffer
HardwarePixelBufferSharedPtr pixelBuffer = _texture->getBuffer();
pixelBuffer->lock(HardwareBuffer::HBL_NORMAL); // for best performance use HBL_DISCARD!
const PixelBox& pixelBox = pixelBuffer->getCurrentLock();
_guiView->renderBGRA(pixelBox.data, pixelBox.getWidth(), pixelBox.getHeight());
pixelBuffer->unlock();
Code: Select all
void WindowImpl::paintOnTexture( BGRAbuffer* tex, const unsigned char* src, const Rect &srcRect, size_t numCopyRects, const Rect *copyRects, int dx, int dy, const Rect &scrollRect )
{
tex->Lock();
unsigned char* texd = tex->getBuffer();
unsigned int tw = tex->width;
// scrolling
{
int wid = scrollRect.width();
int hig = scrollRect.height();
int top = scrollRect.top();
int left = scrollRect.left();
if(dy < 0) // scroll down
{
for (int y = -dy; y < hig; y++)
{
unsigned int tb = ((top + y) * tw + left) * 4;
unsigned int tb2 = tb + dy * tw * 4;
memcpy(&texd[tb2], &texd[tb], wid * 4);
}
}
else if(dy > 0) // scroll up
{
for (int y = hig - dy; y > -1; y--)
{
unsigned int tb = ((top + y) * tw + left) * 4;
unsigned int tb2 = tb + dy * tw * 4;
memcpy(&texd[tb2], &texd[tb], wid * 4);
}
}
if(dx != 0) // scroll
{
int subx = dx > 0 ? 0 : -dx;
for (int y = 0; y < hig; y++)
{
unsigned int tb = ((top + y) * tw + left) * 4;
unsigned int tb2 = tb - dx * 4;
memcpy(&texd[tb], &texd[tb2], wid * 4 - subx);
}
}
}
// copy new rects
for(unsigned int i = 0; i < numCopyRects; i++)
{
Rect cr = copyRects[i];
int wid = cr.width();
int hig = cr.height();
int top = cr.top() - srcRect.top();
int left = cr.left() - srcRect.left();
for(int y = 0; y < hig; y++)
{
unsigned int tb = ((cr.top() + y) * tw + cr.left()) * 4;
memcpy(&texd[tb], &src[(left + (y + top) * srcRect.width()) * 4], wid * 4);
}
}
tex->Unlock();
}
void WindowImpl::paintOnTexture(BGRAbuffer* dest, BGRAbuffer* src, Rect& srcRect)
{
dest->Lock();
src->Lock();
unsigned char* dest_buff = dest->getBuffer();
unsigned char* src_buff = src->getBuffer();
for (int j = 0; j < srcRect.height() && dest->height > (srcRect.mTop + j); j++)
memcpy(&dest_buff[(srcRect.mLeft + (srcRect.mTop + j) * dest->width) * 4], &src_buff[j * srcRect.mWidth * 4], srcRect.mWidth * 4);
dest->Unlock();
src->Unlock();
}