load screen

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.
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

load screen

Post 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();
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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
Image Image Image
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post by avo18 »

i realy did it but nothing .
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post 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
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post 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 
omar shaaban
Posts: 616
Joined: Wed Nov 01, 2006 6:26 pm
Location: Cairo,Egypt
Contact:

Post by omar shaaban »

u dont need allegro SDK u just didnt put the right code!
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post by avo18 »

you realy need allegro SDK to use this code .
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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.
Image Image Image
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post 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
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post 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++; 
} 
rimbou
Posts: 20
Joined: Fri Nov 24, 2006 12:09 pm

Re: load screen

Post 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
Last edited by rimbou on Sat Feb 19, 2011 3:48 am, edited 1 time in total.
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Re: load screen

Post 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();
Oziriz
Posts: 22
Joined: Wed Oct 12, 2005 6:44 pm

Post 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...
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post by avo18 »

its works :D

thanks
Post Reply