Crystal Space
Welcome, Guest. Please login or register.
October 09, 2015, 11:38:02 am

Login with username, password and session length
Search:     Advanced search
9092 Posts in 2100 Topics by 10381 Members
Latest Member: Teresanarek
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Support
| | |-+  how to create a "loading level" sequence
« previous next »
Pages: [1] Print
Author Topic: how to create a "loading level" sequence  (Read 2270 times)
Posts: 19

View Profile Email
« on: August 04, 2008, 04:02:25 am »

I posted this topic in the Tutorial Request Section but since i haven`t got any luck ill try here since its also about development:

Im pretty much done with the first beta of my proyect and to finish some details could anyone show me where to find a tutorial to show loading sequence while loading the game and levels since now i just show the CS output.

like the game Worms that shows a cake bieng eaten or just a loading bar.
Posts: 19

View Profile Email
« Reply #1 on: August 07, 2008, 02:47:56 am »

after a few investigations i discovered the iProgressMeter class but i dont get how to actually use it and also in this topic,419.0.html it says that displaying an image, it would remain through the loading proses.

here is my code for the last option:

vfs->ChDir (mapname);
g2d = g3d->GetDriver2D ();

csRef<iTextureManager> txtmgr = g3d->GetTextureManager ();
csRef<iDataBuffer> buf = vfs->ReadFile ("water.jpg");
csRef<iImage> ifile = imgldr->Load (buf, txtmgr->GetTextureFormat ());
csRef<iTextureHandle> txt = txtmgr->RegisterTexture (ifile, CS_TEXTURE_2D);
img_name = new csSimplePixmap (txt);
img_name->DrawScaled(g3d, 0, 0, g2d->GetWidth(), g2d->GetHeight());

if (!loader->LoadMapFile ("world")) return false;

but i dont see any changes. Am i loading it right? am i suposed to use another image tipe?

any help on how to use the progressmeter or the image would be thanked
Full Member
Posts: 191

View Profile WWW
« Reply #2 on: August 07, 2008, 03:39:44 pm »


  Here's a bit of code from Ecksdee, which used to just clear the screen and write "Loading...":
(you can see the whole file here)

    iObjectRegistry* obj_reg = bl->GetApplication ()->GetObjectRegistry ();
    csRef<iGraphics3D> g3d = csQueryRegistry<iGraphics3D> (obj_reg);
    iGraphics2D* g2d = g3d->GetDriver2D ();
    if (g2d)
      iFontServer* fs = g2d->GetFontServer ();
      csRef<iFont> font = fs->LoadFont ("/xd/data/fonts/menu/f500.ttf", 30.0f);
      csString text ("Loading...");
      int text_width, text_height;
      font->GetDimensions (text.GetData (), text_width, text_height);
      int width = g2d->GetWidth ();
      int height = g2d->GetHeight ();
      g2d->BeginDraw ();
      g2d->ClearAll (g2d->FindRGB (0, 0, 0));
      g2d->Write (font, (int)(width/2 - text_width/2),
            (int)(height/2 - text_height/2), g2d->FindRGB (255, 255, 255), -1,
            text.GetData ());
      g2d->FinishDraw ();
      g2d->Print (0);

For drawing an image (csPixmap), you could look at walktest code (search for cslogo).
Apparently, you're missing some g3d->BeginDraw(CSDRAW_2DGRAPHICS) call (possibly need to use previous draw flags too),
then after you called draw for your pixmap, call g3d->FinishDraw() and g3d->Print(0).

As for iProgressMeter, see for example cslight source code (in CS/apps/tools/cslight/).
The thing is to pass the progress meter as a parameter to engine->Prepare(myProgressMeter).
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 6.308 seconds with 15 queries.