
Hello again! Let me show you the 3rd* of the "Beta" free libraries; "BetaCairo".
Unlike BetaGUI, BetaCairo has one dependency, the Cairo library. Now let me explain it to the uneducated. Cairo is a 2D graphics drawing library which supports bitmap and vector drawing onto an image, as well as basic image manipulation, it also includes support for SVG and many other things, and apparently it's used in Firefox 3.0 for the new canvas tag. So it's pretty nifty.
So I've just made a simple wrapper so it can directly draw onto an Ogre Texture, which can then be on an entity or in the case of of the screenshot onto an overlay ala BetaGUI. The texture then can be updated as many times as you like i.e. an analogue clock or a push button.
How the above image was created is another amazing thing:
Code: Select all
mTexture = new BetaCairo::Texture("wee", 256, 256);
mTexture->fill(Ogre::ColourValue(1.0,0.65,0.65,0.1));
mTexture->drawLine(ColourValue::Red, 10,10, 100,100);
mTexture->setLineThickness(2);
mTexture->drawLine(ColourValue::Green, 100,10, 100,100);
mTexture->setLineThickness(3);
mTexture->drawLine(ColourValue::Blue, 10,46,100,100);
mTexture->drawRectangle(ColourValue(0.5,0.2,0.6,0.4), 190,20,50,30);
mTexture->drawBox(ColourValue::Black, 8,150, 100,60);
mTexture->setFont("Gill sans", 16);
mTexture->drawText("Hello Ogre3d.org!", ColourValue::White,10, 180);
mTexture->redraw();
Code: Select all
MaterialPtr material = MaterialManager::getSingleton().create( "WeeMaterial", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
material->getTechnique(0)->getPass(0)->createTextureUnitState("wee");
material->getTechnique(0)->getPass(0)->setSceneBlending(SBT_TRANSPARENT_ALPHA);
Code: Select all
mGUI->createWindow(Vector4(128,128,256,256),"WeeMaterial", BetaGUI::NONE);
And thats just the tip of the iceberg of what Cairo can do, and hopefully in many versions to come BetaCairo can do as well.
I'll shall be releasing version 001 of the source tommorow under the same license as BetaGUI, and in the same manner.
But I'm already wondering what some crazy Ogre programmer can mix BetaGUI and BetaCairo with; Vector Overlay GUIs. Oh my

Enjoy!
*BetaSound will be released once I get the kinks out of it.