Page 1 of 2

load screen

Posted: Thu Dec 21, 2006 6:32 pm
by avo18
i am trying now to load my BMP file for beginscreen of my game .

i made this code but i realy dont know whats wrong in it .
its dont give's me eny error , but its like its realy dont whant to load my BMP file

Code: Select all

gui::IGUIImage* Loading_Img; 
Loading_Img = guienv->addImage(rect<int>(0,0,0,0)); 
Loading_Img->setImage(driver->getTexture("testscreen.bmp")); 
Loading_Img->draw(); 

Loading_Img->remove();

Posted: Thu Dec 21, 2006 6:37 pm
by JP
Your rectangle to display the image in has an area of 0.

Try something more like (0,0,500,500), that gives you a rectangle 500x500

Posted: Thu Dec 21, 2006 6:38 pm
by avo18
i realy did it but nothing .

Posted: Thu Dec 21, 2006 6:40 pm
by JP
Also, what you're doing by the looks of your code is calling draw (which will draw the image for one frame only) and then removing it straight away. So basically it will never show up for more than a tiny split second i should think.

You need to draw it in a loop, for example you may want to time it to draw for a certain number of seconds or something.

Posted: Thu Dec 21, 2006 6:51 pm
by avo18
i did what you say but its dont works .

if i add time i got this error .

'irr::gui::IGUIElement::draw' : function does not take 1 arguments

Posted: Thu Dec 21, 2006 7:00 pm
by avo18
its works now , i add a other code .
this code is for allegro , you need allegro SDK

Code: Select all

BITMAP *my_pic = NULL; //Declare a BITMAP called my_pic 
	my_pic = load_bitmap("screens\\Loginscreen.bmp", NULL);
	blit(my_pic, screen, 0,0,0,0,1280,1024); //Draw from 0,0 to 50,50 on the screen at (0,0) 
	blit(my_pic, screen, 50,50,100,100,150,150); //Draw from 50,50 to 150,150 on the screen at (100,100) release_screen();
    release_screen();
    rest(2000); 	

    /* and then shut down. */
	destroy_bitmap(my_pic); //Release the bitmap data 

Posted: Thu Dec 21, 2006 9:25 pm
by omar shaaban
u dont need allegro SDK u just didnt put the right code!

Posted: Thu Dec 21, 2006 10:02 pm
by avo18
you realy need allegro SDK to use this code .

Posted: Thu Dec 21, 2006 10:11 pm
by JP
Yeah for that code, but it's not necessary. I presume Allegro is an extra library or something. Irrlicht can do it just fine, all you need is the right understanding and code to do it.

Posted: Thu Dec 21, 2006 11:39 pm
by bitplane
Hmm, that code shows a bitmap for 2 seconds in Allegro, not how to make a loading screen in Irrlicht.
for drawing a 2D bitmap, you could simply read the tutorials-
http://irrlicht.sourceforge.net/tut006.html

For a true loading screen, I'd do something like this

Code: Select all

bool finishedLoading = false;
s32 count=0;
while ( !finishedLoading)
{
   // update the loading screen by drawing a bitmap like in tutorial 6
   ...
   // load the next thing
   finishedLoading = loadNextThing(count);
   count++;
}
obviously you'd need to make your own loadNextThing function and have it load stuff up

Posted: Fri Dec 22, 2006 12:51 pm
by avo18
its dont works with the Irrlicht code .

Code: Select all

bool finishedLoading = true; 
s32 count=0; 
while ( !finishedLoading) 
{ 
   // update the loading screen by drawing a bitmap like in tutorial 6
video::ITexture* images = driver->getTexture("Loginscreen.bmp");
driver->makeColorKeyTexture(images, core::position2d<s32>(0,0));
// finishedLoading = loadNextThing(count); 
   count++; 
} 

Re: load screen

Posted: Fri Dec 22, 2006 2:12 pm
by rimbou
avo18 wrote:i am trying now to load my BMP file for beginscreen of my game .

i made this code but i realy dont know whats wrong in it .
its dont give's me eny error , but its like its realy dont whant to load my BMP file

Code: Select all

gui::IGUIImage* Loading_Img; 
Loading_Img = guienv->addImage(rect<int>(0,0,0,0)); 
Loading_Img->setImage(driver->getTexture("testscreen.bmp")); 
Loading_Img->draw(); 

Loading_Img->remove();
You should place Loading_Img->draw(); inside beginScene and endScene and not in the place you load the image.
________
Fifth-Generation Ford Mustang History

Re: load screen

Posted: Fri Dec 22, 2006 4:10 pm
by avo18
does it schould be like this ?

Code: Select all


gui::IGUIImage * Loading_Img;
Loading_Img = guienv->addImage(rect<int>(0,0,0,0));
Loading_Img->beginScene( driver->getTexture(" testscreen.bmp));
Loading-Img->endScene( driver->texture(" eindescreen.bmp));
Loading_Img->draw();
Loading_Img->remove();

Posted: Fri Dec 22, 2006 7:42 pm
by Oziriz
No, it has to be drawn before ending the drawing of the scene:

Code: Select all

driver->beginScene(true, true, SColor(0, 128, 128, 112));
Loading_Img->draw();
driver->endScene();
And remove the image first when the whole loading process is done...

Posted: Fri Dec 22, 2006 8:00 pm
by avo18
its works :D

thanks