Project Mercury Particle Engine in SilverSprite?

Aug 6, 2009 at 4:03 AM
Edited Aug 6, 2009 at 4:04 AM

I'm trying to get a SilverSprite version of the PMPE up and running but am having some difficulty. The first problem I ran into was with some missing pieces in SilverSprite for the  "Microsoft.Xna.Framework.Content.Pipeline" namespace. I don't know a lot about this namespace but it looks like there is very little code in the particle engine that requires this. The code is below and as you can see it's not much. Granted, this may be the first in a long line of hurdles but I'm really motivated to get this particle engine functional for SilverSprite and would appreciate any direction someone may be able to give.

Thanks for any help.

 

[ContentImporter(".em", DisplayName = "Emitter Importer")]
public class EmitterImporter : ContentImporter<XDocument>
{
    /// <summary>
    /// Called by the framework when importing a game asset.
    /// </summary>
    /// <param name="filename">Name of a game asset file.</param>
    /// <param name="context">Contains information for importing a game asset, such as a logger interface.</param>
    /// <returns>Resulting game asset.</returns>
    public override XDocument Import(string filename, ContentImporterContext context)
    {
        return XDocument.Load(filename);
    }
}

 

 

[ContentTypeWriter]
public class EmitterTypeWriter : ContentTypeWriter<XDocument>
{
    /// <summary>
    /// Compiles a strongly typed object into binary format.
    /// </summary>
    /// <param name="output">The content writer serializing the value.</param>
    /// <param name="value">The value to write.</param>
    protected override void Write(ContentWriter output, XDocument value)
    {
        using (XmlWriter writer = XmlWriter.Create(output.BaseStream, new XmlWriterSettings
        {
            Encoding        = Encoding.UTF8,
            Indent          = true,
            NewLineHandling = NewLineHandling.Entitize
        }))
        {
            if (writer != null)
            {
                value.WriteTo(writer);

                writer.Flush();
                writer.Close();
            }
            else
            {
                throw new Exception("Could not write to XML stream.");
            }
        }
    }

    /// <summary>
    /// Gets the assembly qualified name of the runtime loader for this type.
    /// </summary>
    /// <param name="targetPlatform">Name of the platform.</param>
    /// <returns>Name of the runtime loader.</returns>
    public override string GetRuntimeReader(TargetPlatform targetPlatform)
    {
        switch (targetPlatform)
        {
            case TargetPlatform.Windows:
                return "ProjectMercury.EmitterTypeReader, ProjectMercury.Windows";
            
            case TargetPlatform.Xbox360:
                return "ProjectMercury.EmitterTypeReader, ProjectMercury.Xbox";
        }

        throw new Exception("targetPlatform not supported");
    }
}

 

Coordinator
Aug 6, 2009 at 6:04 PM

Contact me directly and we'll work through this, if you could send me the source that would be perfect.

Bill