Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Correct Loading Display

This thread is locked; no one can reply to it. rss feed Print
Correct Loading Display
Ceagon Xylas
Member #5,495
February 2005
avatar

Okay, here's something I still haven't mastered in gaming which is pretty important: Loading screen percentages.
Lets say I have

class npc{
public:
  int x,y,type;
  float velX,velY;
}npc[40000];

Should have to load 560,000bytes to the memory... Which may take a long while on older computers. Well, what should I do to display how far along the loading is?

Birdeeoh
Member #6,862
February 2006
avatar

Actually, the code segment you posted shouldn't take a noticable about of time to "run" on any age machine that has enough memory... all you're doing is declaring/allocating space in memory. Even if it's initialized to zero, it won't take too long to execute...

If you're refering to some routine you have that actually performs calculations and loads data into that memory location for disk, or something, then you'll have to give a little more of an example... ;)

[url http://developer.berlios.de/projects/openlayer/]OpenLayer[/url is an OpenGL accelerated 2D library for fast and easy graphics development under Allegro

Ceagon Xylas
Member #5,495
February 2005
avatar

Hmm... Alright =]
So then, if I were, say loading alot of bitmaps... just use

BITMAP *frame1,frame2,frame3,frame4;
int percent;

void update_screen(); //draw int precent to the screen

void load() {
  frame1=load_pcx("",NULL);
  percent+=25; update_screen();
  frame2=load_pcx("",NULL);
  percent+=25; update_screen();
  frame3=load_pcx("",NULL);
  percent+=25; update_screen();
  frame4=load_pcx("",NULL);
  percent+=25; update_screen();
}

Right?

Kitty Cat
Member #2,815
October 2002
avatar

As long as they were of mostly similar size, and take about the same amount of time to load. If there's something more annoying than a loading screen, it's a loading screen who's load bar jumps wildly (eg. takes 30 seconds to load 30%, then 10 seconds to load up to 70, then 45 seconds to load the rest). Best to use a looping animation if you can't gaurantee proper percentage timing.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

Go to: