Crystal Space
Welcome, Guest. Please login or register.
October 24, 2017, 01:26:52 am

Login with username, password and session length
Search:     Advanced search
9063 Posts in 2051 Topics by 77923 Members
Latest Member: Hassanl127
* Home Help Search Login Register
  Show Posts
Pages: [1] 2 3 4
1  Crystal Space Development / Support / Re: Playing music from XML map file.. help! on: January 04, 2009, 08:22:45 am

At present I'm playing background music from code as follows:

bool ClientMain::LoadSound ()
  const char* fname = "/std/data/tada.wav";
  csRef<iVFS> vfs = csQueryRegistry<iVFS> (GetObjectRegistry ());

  csRef<iDataBuffer> soundbuf = vfs->ReadFile (fname);
  if (!soundbuf)
    return ReportError ("Can't load file '%s'!", fname);

  csRef<iSndSysData> snddata = sndloader->LoadSound (soundbuf);
  if (!snddata)
    return ReportError ("Can't load sound '%s'!", fname);

  csRef<iSndSysStream> sndstream = sndrenderer->CreateStream (snddata,
  if (!sndstream)
    return ReportError ("Can't create stream for '%s'!", fname);

  sndsource = sndrenderer->CreateSource (sndstream);
  if (!sndsource)
    return ReportError ("Can't create source for '%s'!", fname);
  sndsource3d = scfQueryInterface<iSndSysSourceSoftware3D> (sndsource);

  sndsource3d->SetPosition (GetSoundPos (0));
  sndsource3d->SetVolume (1.0f);

  sndstream->SetLoopState (CS_SNDSYS_STREAM_LOOP);
  sndstream->Unpause ();

  //sndsrc->SetVolume( 1.0 );

  return true;

Now... if I instead "load" the music from XML file as:
    <sound name="bgmusic" file="/std/data/tada.wav" />

How do I access '´bgmusic' from the code and what I have to do to 'play' it?
Sorry if it sounds too basic... never tried like this before.


2  Crystal Space Development / Support / Playing music from XML map file.. help! on: December 08, 2008, 08:00:47 pm
Hi all, and happy holidays to everyone. Here's my annual posting(lol)

To this day I have not understood how do you play a sound from an XML file?
In the good old articles on community site (Structure of an XML world file- part 1 & 2) it says to add:

<sound name="tada.wav">

But this dont work! The message I get is: "Unable to create sound data from /std/data/tada.wav"

I can very well play music from my C++ files but what I NEED to know is how can I play music from XML file.
The music file is perfectly ok.

Using CS & CEL 1.2.1 on WinXP with Win32 1.2_002 libraries. Everything working fine!

Any help would be highly appreciated!

3  Crystal Space Development / Support / Terrain2 ... some questions on: November 28, 2007, 11:10:27 am

I need to render enormous terrains so I decided to start using terrain2 as it seems to provide just what I need (grid etc.)
After reading the complete deails in the manual and looking through the xml in terraini sample, I still have a few questions as follows:

1. Do I understand correctly that the 'gridsize' of each 'cell' would basically always be the same as the x,y size of the height-map? So if your height-map for that cell is 64x64 then the grid-size would also be 64x64 and if height-map is 128x128 then grid would also be 128x128 and so on ?

2. The 'position' of a cell is defined relative to the center of the entire terrain mesh. This is fine for terrains with 2x2 or 4x4 cells. But what if we have a 3x3, meaning a total of 9 cells? There is no 'center' as such unless we count from the 4 corners of the cell that is in the middle. Same would be the case with any odd-number x odd-number grid.

3. <maxloadedcells> defines the maximum cells to pre-load. But if <maxloadedcells> is 20 what does it exectly mean? 20 cells in which direction or what grid format? No grid size would total up to 20 cells.

Well, this is probably all I need to know before jumping off to use terrain2, though I might have more questions later.

Many thanks in advance.


4  Crystal Space Development / Support / Re: problem showing a splash screen on: November 28, 2007, 02:37:37 am
Thanks a lot everyone. I got it working at last.

rvhaasen, you're a life-saver...owe you a beer next time you come over to Tallinn. Smiley

5  Crystal Space Development / Support / Re: problem showing a splash screen on: November 26, 2007, 07:59:10 pm

Thanks for your response.
Yes, my app is not full-screen so I need to find a way how to do this in windowed mode.

So far, I have tried to do this using CEGUI in various ways but nothing works out.
This first splash screen needs to be shown immediately as the window opens, and before any 'world' or 'level' file starts loaded.

If you could help with any ideas how to achieve this I'd very much appreciate.

6  Crystal Space Development / Support / Re: problem showing a splash screen on: November 26, 2007, 02:13:51 pm
Any suggestions please?

Still stuck with this problem, would appreciate a lot if someone could help out.

7  Crystal Space Development / Support / problem showing a splash screen on: November 25, 2007, 03:31:34 pm

Using CS-CEL 1.2 branch on windows:
What would be the best way (memory and resources wise) to show a splash screen from C++ code while the application is loading?

I tried doing it with CEGUI but problem is it would'nt show until the default Run() loop is running.. by which time there is no point to show a splash anyway.
I need to just load a static image and show it immediately as the application window opens.

Many thanks in advance!

8  Associate Projects / CEL Discussion / Re: Creating GUI... on: November 25, 2007, 03:20:43 pm
oh ok, ignore that pls, I found the included DLLs.

I was thinking of using CEGUI to also show a splash screen while the CS/CEL app is loading, but this seems tricky.

Any ideas what would be best way to show a splash sceen?

9  Associate Projects / CEL Discussion / Re: Creating GUI... on: November 24, 2007, 10:35:23 pm

Do I need to download and install CEGUI seperately or is the plugin included in CS 1.2 enough to use CEGUI?

Pitty the documentation in CS manual is rather short and not very clear to understand how to use it.

10  Associate Projects / CEL Discussion / Creating GUI... on: November 24, 2007, 12:28:49 am

When creating GUI in C++ for a CS + CEL based game, what would be the prefered way: CEGUI or Billboards?
What would be advantages/dis-advantages of one over other?


11  Crystal Space Development / Support / Multithreading confusion... on: November 23, 2007, 07:51:24 pm

Here is the problem:

If I were coding a single-threaded game only in C++ (not using CS) here is how I'd normally do things in my main loop: read input from keyboard, move things around in the world, draw to the screen.

Thus in a multiplayer game, one could do so: read input from keyboard, read in from network, move things around in world, send messeges back to network, draw on the screen.

But this does not work if you want a fast efficient networking, so the solution is obviously to make it multi-threaded where one thread continuously reads messegaes from network and sends messages out, while another thread moves the things, draws the screen, cook some eggs and whatever...

The question is, since Crystal Space is already multi-threaded, how can one do the above most efficiently?
Should I run multiple threads myself? Or should I do things as if in a single-thread and CS would (somehow) itself take care of multi-threding it?

So for instnace, if I would do all the reading-writing to network inside processframe() how would CS handle it?

Hope I've been able to explain the question and making some sense Smiley

Any help would be greatly appreciated!

12  Crystal Space Development / Support / Re: flicker in top and right edges of window... on: November 21, 2007, 09:48:59 pm
I'll be damned Cheesy
Spent half a day looking through every kind of complicated possibility but 'clearscreen' never occured to me Smiley

Thanks a lot Darek!

13  Crystal Space Development / Support / Re: flicker in top and right edges of window... on: November 21, 2007, 01:56:48 pm
ok, I can narrow it down this much that ALL the CEL apps with the exception of WalkTut show the same flicker at top and right edges of display window.

So now I'm trying to figure out what are all the other apps doing which Walktut does not do.

14  Crystal Space Development / Support / flicker in top and right edges of window... on: November 21, 2007, 01:27:01 pm

I'm using CS and CEL 1.2 on windows and when I run my application or any other Cell samples I get a thin flickering line on the top and right corenrs of the display window. When I load the same map with a pure CS application such as Simple1 in samples, I do not get that flicker.

Has anyone else experienced the same issue and any ideas how this can be corrected?

15  Crystal Space Development / Support / Re: Problem with integrating "Torque Network Library" on: November 19, 2007, 11:54:53 pm

As this discussion has changed to RakNet, so I continue it in the new thread "CS and RakNet" here:,1511.0.html

Hope you'd find it Smiley

Pages: [1] 2 3 4
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 5.195 seconds with 16 queries.