1 registered members (AndrewAMD),
1,403
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
LBGUI progress bar
#377689
07/15/11 16:12
07/15/11 16:12
|
Joined: Jul 2011
Posts: 15
Coover
OP
Newbie
|
OP
Newbie
Joined: Jul 2011
Posts: 15
|
hi, i wanted to make a progressbar for my game. Because i use LBGUI i used the LBG_progressbar but it just updates the progress when the leven is loaded 100%;
void on_level_event(percent)
{
lbg_splash_progressbar.progress = percent;
LBG_update_progressbar(lbg_splash_progressbar);
if (percent >= 100)
{
loaded_level.ready = 1;
}
}
any idea how to fix that?
|
|
|
Re: LBGUI progress bar
[Re: Coover]
#377694
07/15/11 16:51
07/15/11 16:51
|
Joined: Jul 2011
Posts: 15
Coover
OP
Newbie
|
OP
Newbie
Joined: Jul 2011
Posts: 15
|
thx for your help. i changed the code like that the first is the on_level_laod event and the other the on_level event
void on_level_load_event()
{
loaded_level.ready = 1;
}
void on_level_event(var percent)
{
lbg_splash_progressbar.progress = percent;
LBG_update_progressbar(lbg_splash_progressbar);
}
dont work
Last edited by Coover; 07/15/11 16:55.
|
|
|
Re: LBGUI progress bar
[Re: Coover]
#377696
07/15/11 17:05
07/15/11 17:05
|
Joined: May 2007
Posts: 2,043 Germany
Lukas
Programmer
|
Programmer
Joined: May 2007
Posts: 2,043
Germany
|
To be exact, this is what I had in mind:
void on_level_event(var percent)
{
lbg_splash_progressbar.progress = percent;
LBG_update_progressbar(lbg_splash_progressbar);
}
void on_level_load_event()
{
on_level_event(100); // To make sure it actually hits 100%
loaded_level.ready = 1;
}
But I'm not sure if I understood your initial problem correctly. Is it that the level gets never "ready" or that the progressbar just "jumps" to 100%? If it was the first, it should now actually be solved. If it was the latter one, this might be because maybe your level doesn't need long enough to be loaded? It only updates the progress once per frame, so if it is loaded within one frame, the progressbar will jump from 0 to 100 in that frame. You could try implementing a counter in your event function to see how many frames it takes to load the level. If it is just one frame or so, I guess there is no solution, but it will work better for bigger levels. Else, it must be an other problem.
|
|
|
Re: LBGUI progress bar
[Re: Lukas]
#377714
07/15/11 19:12
07/15/11 19:12
|
Joined: Jul 2011
Posts: 15
Coover
OP
Newbie
|
OP
Newbie
Joined: Jul 2011
Posts: 15
|
i have this
void on_level_event(var percent)
{
lbg_splash_progressbar.progress = percent;
LBG_update_progressbar(lbg_splash_progressbar);
frame++;
}
void on_level_load_event()
{
on_level_event(100); // To make sure it actually hits 100%
loaded_level.ready = 1;
}
then i hit tab and typed frames and he told me 5 and in the manual it says taht the on_level event cant be excuted several times in one frame
|
|
|
Re: LBGUI progress bar
[Re: Lukas]
#377724
07/15/11 19:49
07/15/11 19:49
|
Joined: Jul 2011
Posts: 15
Coover
OP
Newbie
|
OP
Newbie
Joined: Jul 2011
Posts: 15
|
i laod it two times cause its multiplayer game with anet and i started client/swerver mode but i have a wait after the first time and there i looked for the value 5-7 frames but no change of the progressbar here the progress bar code
lbg_splash_progressbar = LBG_create_progressbar (NULL, screen_size.x*0.25, screen_size.y*0.9, screen_size.x*0.5, 1, 1, screen_size.x*0.25, 4, "%.0f%%", LBG_pbmaps(progress_left_tga,progress_middle_tga,progress_right_tga,progress_bar_tga), PBF_SHOW, 100, 5);
wait(1);// wait und update müssen damit 0 angezeigt wird sonst ganzes bild in voller größe
LBG_update_progressbar(lbg_splash_progressbar);
|
|
|
|