Click or drag to resize
DigitalRunePre-Built Content

This section explains how to add pre-built assets (effects, textures) which are required by DigitalRune Graphics at runtime.

Note Note

If your game uses only XNA stock effects and if it does not use any of the predefined materials, post-processors or advanced renderers, it is not necessary to add the pre-built content to your project.

Some newer platforms (e.g. Linux, Mac OS X, Android, iOS) do not yet support advanced graphics (e.g. deferred rendering, post-processing). In this case there is no pre-built content necessary for this platform.

Windows Phone 7 projects do not need pre-built assets at all because custom shaders are not supported on this platform.

This topic contains the following sections:

Location of pre-built content

DigitalRune Graphics requires several effects and textures. These assets include effects for built-in renderers, post-processing effects, lookup textures, and predefined material effects. These assets are pre-built and can be found in these folders:

Framework

Platform

Content Folder

XNA Framework

Windows

Content\XNA\Windows

XNA Framework

Xbox 360

Content\XNA\Xbox360

MonoGame

Windows

Content\MonoGame\Windows

MonoGame

Windows Phone 8

Content\MonoGame\WindowsPhone

MonoGame

Windows Store

Content\MonoGame\WindowsStore

Each folder contains either

  • an XNA content project (*.contentproj) with the pre-built assets (*.xnb),
  • or a ZIP file (DigitalRune.zip) containing the pre-build assets (*.xnb).
Add pre-built content to project

Using content projects

If the pre-built content consists of a content project (*.contentproj) and XNB files, you need to a add a content reference to this content project in your XNA game project. The content project then automatically copies the pre-built assets to the output folder of the game.

First, you need to include the content project in the solution:

  1. Right-click the solution and choose Add | Existing Project....
  2. Select the content project for your target platform, for example:

    For XNA on Windows (desktop) use

    <DIGITALRUNE_FOLDER>\Content\XNA\Windows\DigitalRune.Graphics (Windows).contentproj

    For Xbox 360 use

    <DIGITALRUNE_FOLDER>\Content\XNA\Xbox360\DigitalRune.Graphics (Xbox 360).contentproj

    and click Open.

Then add a content reference to the main project:

  1. Open the Solution Explorer in Visual Studio.
  2. Right-click the project (or right-click the folder Content References within the project) and choose Add Content Reference...
  3. In the tab Projects select the DigitalRune Graphics content project and click OK.

The content project copies the pre-built assets to the output folder of the game.

When you initialize the GraphicsManager in your game code, you need to provide a ContentManager which can load the pre-built assets. You can use the default ContentManager of the XNA game (Game.Content) or create a new content manager. For example:

C#
var graphicsContentManager = new ContentManager(Services, "Content");
myGaphicsManager = new GraphicsManager(GraphicsDevice, Window, graphicsContentManager);

Please have a look at the DigitalRune Samples for more detailed example code.

Using ZIP file

If the pre-built content consists of a ZIP file, this file needs to be copied to the output folder of the game. In the game code you need to create a content manager which can read from the ZIP file using the DigitalRune Storage API.

To automatically add the ZIP file to the output folder of your game:

  1. In Visual Studio add a folder named "Content" to your game project.
  2. In the Visual Studio Solution Explorer right-click the "Content" folder and choose Add | Existing Item.
  3. Select the file DigitalRune.zip for your target platform, for example:

    For MonoGame on Windows (desktop) use

    <DIGITALRUNE_FOLDER>\Content\MonoGame\Windows\DigitalRune.zip

    Click the drop down arrow next to the Add button and select Add As Link.

  4. In the solution explorer right-click the newly added "DigitalRune.zip" and select Properties.
  5. In the properties window set the "Build Action" to "Content" and the "Copy to Output Directory" to "Copy if newer".

When you initialize the GraphicsManager in your game code, you need to provide a ContentManager which can load the pre-built assets. For example:

C#
var titleStorage = new TitleStorage("Content");
var graphicsStorage = new ZipStorage(titleStorage, "DigitalRune.zip");
var graphicsContentManager = new StorageContentManager(Services, graphicsStorage);
myGaphicsManager = new GraphicsManager(GraphicsDevice, Window, graphicsContentManager);

Please have a look at the DigitalRune Samples for more detailed example code.