I'm using irrlicht GUI and i need something like progress bar or any thing else when loading a model or scene
please help me
progressbar
Re: progressbar
Those are 2 problems really. First is gui - if you use Irrlicht svn trunk you can use IGUIImage::setDrawBounds to use that element like a progressbar (where progress can go in all directions).
The other problem is harder - you would need progress information while loading a model and you can't get that so easy. So you can do progress bars if you load lots of models and update it in between - but hard to get feedback for loading a single model.
The other problem is harder - you would need progress information while loading a model and you can't get that so easy. So you can do progress bars if you load lots of models and update it in between - but hard to get feedback for loading a single model.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: progressbar
I will load a lot of models , can you give me an example for loading window
Re: progressbar
I can only repeat myself from above. It's not in Irrlicht 1.8, but if you use Irrlicht svn trunk then you can use IGUIImage::setDrawBounds. That function documented and if there are problems with the documentation I'm glad to improve it. If you need an example for it's use you can check this file: https://code.google.com/p/irr-playgroun ... _image.cpp - just copy it over one of the examples (only Irrlicht trunk!).
For the loading itself - not sure what I could show you there. You just load a model. Show a little bit more of the image. Load the next model, etc.
For the loading itself - not sure what I could show you there. You just load a model. Show a little bit more of the image. Load the next model, etc.
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
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: progressbar
Here's an example code of how I would do it (tested and working):
Code: Select all
#include <iostream>
#include <irrlicht.h>
#include <cstdlib>
using namespace std;
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
int main()
{
//Start Irrlicht.
IrrlichtDevice* irrdevice = createDevice(EDT_OPENGL, dimension2d<u32>(800,100),
32,
false,
false,
false);
if(!irrdevice)
{
cout << "Irrlicht failed to start!\n";
return 1;
}
irrdevice->setWindowCaption(L"Progress Bar Test");
ITimer* irrtimer = irrdevice->getTimer();
IVideoDriver* irrvd = irrdevice->getVideoDriver();
//Create some variables to calculate bar percentage.
int current_file = 0; //Current amount of files loaded.
int max_file_count = 2000; //Total amount of files.
u32 f_time = 50; //Time in MS between each file "load".
u32 t_save = irrtimer->getTime(); //Use this to calculate how much time has passed.
//Render loop.
while(irrdevice->run())
{
irrvd->beginScene(true, true, SColor(0,0,0,0)); //Draw blackness.
//Update file count.
u32 n_time = irrtimer->getTime();
if(n_time - t_save >= f_time)
{
current_file++;
t_save = n_time;
}
//Draw the bar.
float percentage = ((float)current_file / (float)max_file_count);
int bar_length = round(percentage * 800);
irrvd->draw2DRectangle(rect<s32>(0,0,bar_length,100),
SColor(255,255,0,0),
SColor(255,255,0,0),
SColor(255,50,0,0),
SColor(255,50,0,0));
//Update the window title to include the percentage.
stringw n_title = "Progress Bar Test - ";
n_title += (int)round(percentage * 100);
n_title += "%";
irrdevice->setWindowCaption(n_title.c_str());
//If complete, leave the program.
if(current_file >= max_file_count)
{
break;
}
irrvd->endScene(); //Display render.
}
//Drop the engine.
irrdevice->drop();
return 0;
}