problem when put iGUIImage

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
leorodrigues
Posts: 2
Joined: Tue Jul 30, 2013 8:16 pm

problem when put iGUIImage

Post by leorodrigues »

Code: Select all

 
IGUIImage* fundo = device->getGUIEnvironment()->addImage((("MyImage.png"), 0, 1, rect<s32>(0,0,412,74)));
 
What do I'm doing wrong to put the image? it is the right size but the color is a gray transparent.

Obs.: google translator ... :S

thank's
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: problem when put iGUIImage

Post by CuteAlien »

I'm confused that this even compiles, I guess all the extra brackets you added trick the compiler in some way. You can't just pass other parameter types to a function than those it expects in c++!

If you check the documentation - the first parameter it wants is a 'video::ITexture *' and not a string.

Irrlicht comes with examples (check the examples folder). You can open a project file which will build them all. If you use an IDE like VisualStudio or C::B you can search for a text over all files in the solution with ctrl+shift+f. Search for "addImage" and you will find several examples (04,05,11,12,16,17 and 21) which all can show you how to use that function correctly.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: problem when put iGUIImage

Post by chronologicaldot »

lol. I don't think the the transparent gray is the image. It's the background of the GUI element.
Try this:

Code: Select all

 
IImage* img = device->getVideoDriver()->getImage( "MyImage.png" );
 
IGUIImage* fundo = device->getGUIEnvironment()->addImage( img, 0, 1, rect<s32>(0,0,412,74) );
 
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: problem when put iGUIImage

Post by CuteAlien »

@ chronologicaldot: Dude... it's textures, there is no getImage ;-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
gerdb
Posts: 194
Joined: Wed Dec 02, 2009 8:21 pm
Location: Dresden, Germany

Re: problem when put iGUIImage

Post by gerdb »

IGUIImage* fundo = device->getGUIEnvironment()->addImage((("MyImage.png"), 0, 1, rect<s32>(0,0,412,74)));

Really funny you got this to compile ( poor poor compiler ). :?
Post Reply