smarthaert / phoenixlib

Automatically exported from code.google.com/p/phoenixlib
0 stars 0 forks source link

TPhxParticleManager #124

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I have to use multiple particlemanagers in my game to allow particles in 
different layer.

My qyestio is :
Do I have to Load All Particles in All of my Particle Menagers?

It would be nice to have a way to create just one TPHXParticleEffectList, and I 
load all efects there, and so I can share it between Particle Managers. What do 
you think?

Original issue reported on code.google.com by wagenhei...@gmail.com on 5 Feb 2011 at 12:46

GoogleCodeExporter commented 9 years ago
Well! I don't know if will works, but I have created something like this: I 
will test it!

procedure LoadEffectsFromAnotherParticleManager(var AParticleManager: 
TPHXParticleManager);
var
  Index: Integer;
  AStream: TMemoryStream;
begin
  for Index := 0 to GameParticles.Effects.Count - 1 do
    begin
      AStream := TMemoryStream.Create;
      GameParticles.Effects[Index].SaveToStream(AStream);
      AParticleManager.Effects.Add.LoadFromStream(AStream);
      AStream.Free;
    end;
end;

Original comment by wagenhei...@gmail.com on 5 Feb 2011 at 12:59

GoogleCodeExporter commented 9 years ago
Well... A Small Fix!
  for Index := 0 to GameParticles.Effects.Count - 1 do
    begin
      AStream := TMemoryStream.Create;
      GameParticles.Effects[Index].SaveToStream(AStream);
      AStream.seek(0,soFromBeginning);
      AParticleManager.Effects.Add.LoadFromStream(AStream);
      AStream.Free;
    end;

Original comment by wagenhei...@gmail.com on 5 Feb 2011 at 1:08

GoogleCodeExporter commented 9 years ago

Original comment by andreas....@gmail.com on 8 Aug 2013 at 2:11