Loading, please wait!

Started by
3 comments, last by ff8 18 years, 10 months ago
Hello! I'm about this sentence. How to make this picture, when game data loading? Is somewhere source code about this in C++ OpenGL?
Advertisement
Make a game state check... for instance:

Pseudo code:switch(GameState){case Menu: //draw menu stuffbreak;case Loading://draw stuffbreak;case PlayLevel://drawStuffbreak;}


you get the point, right? :) this should also be done with Update(), so that you dont update objects while in the menu etc..

Hope it helps!
"Game Maker For Life, probably never professional thou." =)
Or use classes with virtual functions that control the different states of your app/game, switching between the states in the update function (and deleting the old states if they aren't needed anymore). It's harder to implement, but doesn't chew up processing power while sorting through the switch statement (although if you don't have many states, a switch statement should be fine).
Are you looking for a graphical status bar?

Those are typically done through two images:
1) An image of the status bar empty.
2) An image of the status bar 100% complete.

The key is to draw only parts of the second image depending on how many of your resources are loaded.
Hi,
The idea is simple let's say you have these files
video.avi (5MB) , sound.mp3(1MB) ,texture.bmp {1MB)
see this pseudo code:
SizeofTheFiles=7;//count it by your selfVideo_AVI_Percent=5/SizeofTheFiles;//this is float numberSound_Mp3_Percent=1/SizeofTheFiles;Texture_Bmp_Percent=1/SizeofTheFiles;Scale_=0;//for scaling the loading barVideo_=false;//to check if we load it or notSound_=false;while(Loop_of_The_Game){DrawTheBar();glScalef(Scale_,1,1);if(!Video_){LoadVideo("video.avi");Scale_+=Video_AVI_Percent;Video_=!Video_;}elseif(!Sound_){LoadSound("sound.mp3");Scale_+=Video_Mp3_Percent;Sound_=!Sound_;}else{LoadTexture("texture.bmp");Scale_+=Video_Bmp_Percent;}SendTheBuffer();}

I hope this is what you want.
bye

This topic is closed to new replies.

Advertisement