Crystal Space
Welcome, Guest. Please login or register.
September 01, 2014, 03:31:54 pm

Login with username, password and session length
Search:     Advanced search
9009 Posts in 2043 Topics by 8372 Members
Latest Member: Berger4
* Home Help Search Login Register
+  Crystal Space
|-+  Crystal Space Development
| |-+  Game Content Creation
| | |-+  image during level load
« previous next »
Pages: [1] Print
Author Topic: image during level load  (Read 2961 times)
Panch
Jr. Member
**
Posts: 80


View Profile Email
« on: July 02, 2007, 06:12:48 pm »

I found a post that dated back to 2005 that said if an image was loaded prior to loading a level, then the image would just stay as the level is loaded. I'm trying to do that but the screen is just black. Any ideas?

Code to draw a piximap:
Code:
// Draw a piximap
void Time::DrawPixi(string image)
{
string imagex;
imagex = "/lib/std/" + image;
const char* pixi = imagex.c_str ( );

// Load HUD piximap
iTextureManager* txtmgr = g3d->GetTextureManager ();
csRef<iDataBuffer> buf = VFS->ReadFile (pixi);
csRef<iImage> ifile = imgldr->Load (buf, txtmgr->GetTextureFormat ());
csRef<iTextureHandle> txt =
txtmgr->RegisterTexture (ifile, CS_TEXTURE_2D);
csSimplePixmap* pixmap = new csSimplePixmap (txt);
pixmap->DrawScaled (g3d, 10, 10, 300, 300);

}

Code to load the map:
Code:
  // Load the level file which is called 'world'.
DrawPixi("cslogo2.png"); 
if (!loader->LoadMapFile ("world"))
    ReportError("Error couldn't load level!");
  //console->Toggle();

  csTextProgressMeter* meter = new csTextProgressMeter (system_console);   
  engine->Prepare (meter);
  meter->Reset();

The PixiMap function works fine outside of trying to get it to show an image before/during a level load.

TIA Smiley
« Last Edit: July 02, 2007, 06:19:22 pm by Panch » Logged
Panch
Jr. Member
**
Posts: 80


View Profile Email
« Reply #1 on: July 02, 2007, 10:20:46 pm »

Well after looking it, it could be a few things. Maybe it's because the loader->LoadMapFile clears out the engine even if the flag is set not to?

**Still haven't figured this out yet. The PixiMap wants to be loaded up before any frames are processed it seems, as I can't call it during runtime to display a 2D image. Is there any other method of displaying 2D images on the canvas other than piximaps?

Thanks Smiley
« Last Edit: July 18, 2007, 04:07:49 pm by Panch » Logged
jorrit
Administrator
Hero Member
*****
Posts: 1706


View Profile
« Reply #2 on: July 18, 2007, 07:45:21 am »

You also need to code to flush the screen to the display after drawing the image. i.e. g3d->FinishDraw(), g3d->Print().

Greetings,
Logged
Panch
Jr. Member
**
Posts: 80


View Profile Email
« Reply #3 on: July 18, 2007, 04:10:21 pm »

Yeah that makes sense, I was actually calling my FinishDraw function but the order of it was wrong and my FinishDraw does other stuff as well.

Thanks Smiley
Logged
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 7.205 seconds with 18 queries.