Adding Xen to Your Game

Creating a New Project

Xen currently supports 4 different XNA platforms:
  • Windows
  • Windows Phone
  • Xbox 360
  • Silverlight (via SilverSprite)
  1. Create a new XNA 4.0/Silverlight 4 project with Visual Studio.
  2. For Silverlight, you will need to add the SilverArcade.SilverSprite and SilverArcade.SilverSprite.Core references to your project and add your game class to your XAML somewhat like this: (Visit the SilverSprite site for more info)
<UserControl x:Class="Demo_Viewport_Silverlight.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="800" d:DesignWidth="480"
    xmlns:game="clr-namespace:Demo_Viewport">
    <Grid x:Name="LayoutRoot">
        <Canvas>
            <game:GameMain x:Name="game"/>
        </Canvas>
    </Grid>
</UserControl>
  1. And then follow the steps in the next section.

Adding Xen to an Existing Project

Xen allows you to interact with its features at various layers of its architecture as you see fit and/or need. For example, if you only need the Xen2D features to draw lines, you only need XenAspects and Xen2D. The following steps will allow you to use all of Xen's features.
  1. Add Reference to all of the .dll files included for your target platform (Windows, Phone, Xbox, Silverlight) folder in the Xen library you downloaded.
  2. Add the following namespaces to your game's .cs file:
using XenAspects;
using Xen2D;
using XenGameBase;
  1. Replace Microsoft.Xna.Framework.Game with GameBase. Example:
//public class Game1 : Microsoft.Xna.Framework.Game
public class Game1 : GameBase
  1. And you are now ready to use Xen!

TODO: this doc does not transition well into the primitives section.

Last edited Feb 9, 2011 at 6:41 PM by robzhu, version 4

Comments

No comments yet.