Mercury project page can be found from here!
( Source of this tutorial and compiled exe )
Download: MercuryExample.Zip
Only thing that bothers me, is the lack of tutorials for it. There really isnt anything, that helps "newbie" coders to get those beatifull particles from editor, to XNA. Well, i made a short example project, that loads and draws the "BasicExplosion", that comes as an example with the editor.
Its quite easy to get particles to drawn on screen. You need to add that particle xml file and all the textures it needs, to content of your XNA project. After that, its just coding.
// Add MercuryProject.dll reference to your projectInside the Game class, add:
// Add using statements
using ProjectMercury;
using ProjectMercury.Emitters;
using ProjectMercury.Modifiers;
using ProjectMercury.Renderers;
// Renderer that draws particles to screenInside the Game constructor add:
Renderer myRenderer;
// Particle effect object to store the info about particle
ParticleEffect myEffect;
// Create new renderer and set its graphics devide to "this" deviceInside LoadContent add:
myRenderer = new SpriteBatchRenderer
{
GraphicsDeviceService = graphics
};
myEffect = new ParticleEffect();
myEffect = Content.Load("BasicExplosion");
myEffect.LoadContent(Content);
myEffect.Initialise();
myRenderer.LoadContent(Content);
Inside Update add:
// get the latest mouse stateAnd finally, add to Draw:
MouseState ms = Mouse.GetState();
// Check if mouse left button was presed
if (ms.LeftButton == ButtonState.Pressed)
{
// Add new particle effect to mouse coordinates
myEffect.Trigger(new Vector2(ms.X, ms.Y));
}
// "Deltatime" ie, time since last update call
float SecondsPassed = (float)gameTime.ElapsedGameTime.TotalSeconds;
myEffect.Update(SecondsPassed);
myRenderer.RenderEffect(myEffect);
Now, compile.
Remember to add the dll to Content references too, or else, it wont know how to import those files. Now, if its running, just click with mouse and enjoy.