please help me
![Shocked :shock:](./images/smilies/icon_eek.gif)
![Shocked :shock:](./images/smilies/icon_eek.gif)
![Shocked :shock:](./images/smilies/icon_eek.gif)
![Shocked :shock:](./images/smilies/icon_eek.gif)
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;
}