Add Values to file loading strings

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
Jorik
Posts: 44
Joined: Tue Dec 08, 2009 4:47 pm

Add Values to file loading strings

Post by Jorik »

Hi,

i´m sorry, maybe my question is more c++ syntax than irrlicht, but i think someone can help me here.

I want to load several Itexture at the same time, but dont know how to use the right syntaxis in the string where the image position is defined.

I Create first an itexture array:

Code: Select all

video::ITexture *_pLoadingLogo[11];
Then i want to fill it, but here is my problem, i dont know how to tell the string to load different textures ( the textures are name from 0 to 11):

Code: Select all

for (int i=0; i<12; i++)
{
_pLoadingLogo[i]  =  Env::Driver->getTexture("../data/textures/dummys/i.png");
}

how can i tell the programm to define the i value as the name of the picture?
Bate
Posts: 364
Joined: Sun Nov 01, 2009 11:39 pm
Location: Germany

Post by Bate »

you cannot vary the path like that directly, save the path in a string.

Code: Select all

stringc mystring = "../data/textures/dummys/";
mystring += i;
mystring += ".png";

LoadingLogo[i]  = Driver->getTexture( mystring )
not sure if stringc is correct for path though, check API (could be mystring.c_str() ).
Never take advice from someone who likes to give advice, so take my advice and don't take it.
Post Reply