Page 1 of 1

IrrlichtRenderer problem

Posted: Tue Aug 28, 2012 19:23
by communism
I keep getting this error when I try to construct a CEGUIIrrlichtRenderer...

error C2664: 'CEGUI::IrrlichtRenderer::IrrlichtRenderer(irr::IrrlichtDevice &)' : cannot convert parameter 1 from 'irr::IrrlichtDevice *' to 'irr::IrrlichtDevice &'

I'm using Visual Studio 9 (2008)

And the code that matters...

Code: Select all

//Receiver is my Event Receiver for Irrlicht...
IrrlichtDevice * device = createDevice(video::EDT_OPENGL, dimension2d<u32>(640, 480), 16, false, false, false, &receiver);
CEGUI::IrrlichtRenderer * rend = new CEGUI::IrrlichtRenderer(device);

Re: IrrlichtRenderer problem

Posted: Tue Aug 28, 2012 19:46
by DEvil HUnter
i would recommend buying and reading a book about c or c++. there you should read the chapter about pointers and references.

take a look at each byte in the following code:

Code: Select all

IrrlichtDevice & device = createDevice(video::EDT_OPENGL, dimension2d<u32>(640, 480), 16, false, false, false, &receiver);


hint: -> * -> & this time

Re: IrrlichtRenderer problem

Posted: Tue Aug 28, 2012 20:43
by Kulik
Actually

Code: Select all

IrrlichtDevice & device = *createDevice(video::EDT_OPENGL, dimension2d<u32>(640, 480), 16, false, false, false, &receiver);


the * before createDevice is important.

Re: IrrlichtRenderer problem

Posted: Wed Aug 29, 2012 15:43
by communism
Unfortunately the code;

Code: Select all

IrrlichtDevice * device = createDevice(video::EDT_OPENGL, dimension2d<u32>(640, 480), 16, false, false, false, &receiver);

Is necessary, all other references to the "device" only work if it is a pointer.
I attempted the following code...

Code: Select all

CEGUI::IrrlichtRenderer * rend = new CEGUI::IrrlichtRenderer(*device)

But I get the following error;
cannot access protected member declared in class 'CEGUI::IrrlichtRenderer'

Re: IrrlichtRenderer problem

Posted: Wed Aug 29, 2012 18:05
by Kulik
http://www.cegui.org.uk/docs/current/re ... orial.html

You can't construct the renderer like this. If anything it would be the IR::create static method.