The basic tutorial 7 needs be updated

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
brkpnt
Gnoblar
Posts: 4
Joined: Tue Jan 10, 2012 9:23 pm

The basic tutorial 7 needs be updated

Post by brkpnt »

Hello, sorry if this is a wrong sections to say this. But i saw the tutorial 7, and some functions and namespaces there just not exist in the last release of CEGUI.
The tutorial really needs very very little changes.

Bye.
Transporter
Minaton
Posts: 933
Joined: Mon Mar 05, 2012 11:37 am
Location: Germany
x 110

Re: The basic tutorial 7 needs be updated

Post by Transporter »

Feel free to change the wiki site.
Fingon
Gnoblar
Posts: 5
Joined: Wed Oct 16, 2013 4:12 pm
x 1

Re: The basic tutorial 7 needs be updated

Post by Fingon »

I'm just starting to learn Ogre and CEGUI, and I managed to build CEGUI 0.8.2 against a precompiled version of Ogre 1.8.1 in Visual Studio 10. This took some time, but it worked using the guide on the CEGUI site. So I was happy, but then frustration hit when I noticed that this tutorial completely failed for CEGUI 0.8.2. It was probably written for some 0.7.x version, and a lot of syntax changed.

So I plodded on and managed to find most of the required changes. I have updated the wiki to reflect these changes in CEGUI 0.8.2. I have kept everything as is, and just added comments to what should be changed for 0.8.2. So everything works now, up until RTT.

For RTT I was unable to get it working. My code compiles already (which is half the work), but the inset image stays black. Maybe somebody more experienced with CEGUI can help me out? (I'll also post this on the CEGUI forums). Here's what I have so far:

Code: Select all

CEGUI::Texture &guiTex = mRenderer->createTexture("texname", tex);
	
// image
const CEGUI::Rectf rect(CEGUI::Vector2f(0.0f, 0.0f), guiTex.getOriginalDataSize());
const CEGUI::String name = "RTTImage";
CEGUI::BasicImage image("RTTImage", &guiTex, rect, CEGUI::Vector2f(0, 0), CEGUI::AutoScaledMode::ASM_Both, CEGUI::Sizef(0, 0));
CEGUI::ImageManager::getSingleton().addImageType<CEGUI::BasicImage>(name);

// static image
CEGUI::Window *si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "RTTWindow");
si->setSize(CEGUI::USize(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.4f, 0)));
si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, 0.0), CEGUI::UDim(0.0f, 0.0f)));
si->setProperty("Image", "RTTImage");
// Or maybe this ?
// si->setProperty("Image", CEGUI::PropertyHelper<CEGUI::Image *>::toString(&image));
	
sheet->addChild(si);
dermont
Bugbear
Posts: 812
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: The basic tutorial 7 needs be updated

Post by dermont »

Fingon wrote:I'm just starting to learn Ogre and CEGUI, and I managed to build CEGUI 0.8.2 against a precompiled version of Ogre 1.8.1 in Visual Studio 10. This took some time, but it worked using the guide on the CEGUI site. So I was happy, but then frustration hit when I noticed that this tutorial completely failed for CEGUI 0.8.2. It was probably written for some 0.7.x version, and a lot of syntax changed.

So I plodded on and managed to find most of the required changes. I have updated the wiki to reflect these changes in CEGUI 0.8.2. I have kept everything as is, and just added comments to what should be changed for 0.8.2. So everything works now, up until RTT.

For RTT I was unable to get it working. My code compiles already (which is half the work), but the inset image stays black. Maybe somebody more experienced with CEGUI can help me out? (I'll also post this on the CEGUI forums). Here's what I have so far:

Code: Select all

CEGUI::Texture &guiTex = mRenderer->createTexture("texname", tex);
	
// image
const CEGUI::Rectf rect(CEGUI::Vector2f(0.0f, 0.0f), guiTex.getOriginalDataSize());
const CEGUI::String name = "RTTImage";
CEGUI::BasicImage image("RTTImage", &guiTex, rect, CEGUI::Vector2f(0, 0), CEGUI::AutoScaledMode::ASM_Both, CEGUI::Sizef(0, 0));
CEGUI::ImageManager::getSingleton().addImageType<CEGUI::BasicImage>(name);

// static image
CEGUI::Window *si = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage", "RTTWindow");
si->setSize(CEGUI::USize(CEGUI::UDim(0.5f, 0), CEGUI::UDim(0.4f, 0)));
si->setPosition(CEGUI::UVector2(CEGUI::UDim(0.5f, 0.0), CEGUI::UDim(0.0f, 0.0f)));
si->setProperty("Image", "RTTImage");
// Or maybe this ?
// si->setProperty("Image", CEGUI::PropertyHelper<CEGUI::Image *>::toString(&image));
	
sheet->addChild(si);
Not sure this is the correct way to do this but you could try creating an instance of Image ("BasicImage") from the ImageFactory.

Code: Select all


//CEGUI::BasicImage image("RTTImage", &guiTex, rect, CEGUI::Vector2f(0, 0), CEGUI::AutoScaledMode::ASM_Both, CEGUI::Sizef(0, 0));
//CEGUI::ImageManager::getSingleton().addImageType<CEGUI::BasicImage>(name);
    CEGUI::BasicImage* image = (CEGUI::BasicImage*)( &CEGUI::ImageManager::getSingleton().create("BasicImage",name));
   image->setTexture(&guiTex);
   image->setArea(rect);
   image->setAutoScaled(CEGUI::ASM_Both);
Fingon
Gnoblar
Posts: 5
Joined: Wed Oct 16, 2013 4:12 pm
x 1

Re: The basic tutorial 7 needs be updated

Post by Fingon »

Wonderful, this works! Thanks a lot!
I'll update the tutorial in the wiki.
Post Reply