Sign in to follow this  

content pipeline tutorials

This topic is 3463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone have some practical guides to using the content pipeline with your own content? I have a bunch of XML-serialized objects I'd like the content pipeline to load, but I'm not sure how to go about it. Also, is there a way to make the content pipeline read the binary data from an arbitrary stream, such as a memory stream?

Share this post


Link to post
Share on other sites
First one i didnt get.

Second, i use this to load from a pak system i got.

    
public class PAKContentManager : ContentManager
{
public string packname;
public string packdir;

Pak pak = new Pak();
public PAKContentManager(IServiceProvider serviceProvider)
: base(serviceProvider)
{
}

protected override Stream OpenStream(string assetName)
{
pak.OpenPack("Data/" + packname);
byte[] data = pak.GetFileData(assetName, packdir);
pak.Dispose();

MemoryStream stream = new MemoryStream(data);
return stream;
}
}



then to load somewhere (just an excample).

private PAKContentManager pakcontent;

and then init it
pakcontent = new PAKContentManager(Services);

then to load from a pak
Lists.defaultFont = pakcontent.Load<SpriteFont>("Arial.xnb");

Share this post


Link to post
Share on other sites

This topic is 3463 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this