[Solved]Add texture to gui window

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
RespectIsEverything
Posts: 30
Joined: Fri Feb 01, 2013 12:06 pm

[Solved]Add texture to gui window

Post by RespectIsEverything »

Hello again.I try to make a inventory gui.But,I want add background texture to gui window.
My codes=

Code: Select all

 
 
void Init()
{
 
rect<s32> windowRect=rect<s32>(0,0,400,500);
 
IGUIWindow * window=Environment->addWindow(windowRect,false,L"Inventory",0,-1);
window->setDrawTitlebar(false);
 
backgroundTexture= Device->getVideoDriver()->getTexture("Data/inv.png");
 
window->addChild((IGUIElement*)backgroundTexture);
 
}
 
 
But it gives error(0xC0000005) at < gui->drawAll(); >.I initialized gui.If i don't use < window->addChild((IGUIElement*)backgroundTexture); >,it shows window.
Last edited by RespectIsEverything on Tue Feb 12, 2013 5:20 pm, edited 1 time in total.
Seven
Posts: 1034
Joined: Mon Nov 14, 2005 2:03 pm

Re: Add texture to gui window

Post by Seven »

you are casting a texture to a guielement? I dont think that you can do that.
RespectIsEverything
Posts: 30
Joined: Fri Feb 01, 2013 12:06 pm

Re: Add texture to gui window

Post by RespectIsEverything »

Thanks for the reply.What should i do to draw texture?
user-r3
Posts: 70
Joined: Tue Dec 07, 2010 4:09 pm

Re: Add texture to gui window

Post by user-r3 »

You may have a look into the IGUIImage class

http://irrlicht.sourceforge.net/docu/cl ... image.html

you could create one, use the setImage() function to set your ITexture as the image and pass the image to the addChild() function

not tested, though ;)
RespectIsEverything
Posts: 30
Joined: Fri Feb 01, 2013 12:06 pm

Re: Add texture to gui window

Post by RespectIsEverything »

Thanks,it worked perfectly :D
Post Reply