Skip to main content
Tweeted twitter.com/#!/StackGameDev/status/414514619232026624
deleted 1122 characters in body; edited title
Source Link
House
  • 73.5k
  • 17
  • 188
  • 276

Get Where does the Game class on Silverlight+XNA projectcome from in the DrawableGameComponent constructor?

i makeI'm making a project to Windows Phone using Silverlight + XNA, but i dontI don't know how I can use the DrawableGameComponent because the constructor requirerequires a game ClassGame class, look how areit looks like this:

Planet.cs

class Planet : DrawableGameComponent
{
      ...    
    
public Planet(Game game)
     : base(game){
        
    {
}

but in my first page of silverlight+xnaSilverlight and XNA project not is a GameGame class isit's this:

GamePage.xaml.cs

public partial class GamePage : PhoneApplicationPage
    {
        ContentManager contentManager;
        GameTimer timer;
        SpriteBatch spriteBatch;
        GraphicsDevice graphic;
        TouchCollection touch;
        List<Planet> list;
        GameComponentCollection components;
        DrawableGameComponent player;

        int device_width = SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width;
        int device_height = SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height;


        public GamePage()
        {
            InitializeComponent();

            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;
            components = new GameComponentCollection();
            Planet planet = new Planet(new Game());
            components.Add()
            // Create a timer for this page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

        }
        

Where do I need getfind the GameGame class how i make thisto pass into the DrawableGameComponent constructor? thanks much much.

Get the Game class on Silverlight+XNA project

i make a project to Windows Phone using Silverlight + XNA, but i dont can use the DrawableGameComponent because the constructor require a game Class, look how are:

Planet.cs

class Planet : DrawableGameComponent
{
      ...    
    
public Planet(Game game)
     : base(game){
        
{

but in my first page of silverlight+xna project not is a Game class is this:

GamePage.xaml.cs

public partial class GamePage : PhoneApplicationPage
    {
        ContentManager contentManager;
        GameTimer timer;
        SpriteBatch spriteBatch;
        GraphicsDevice graphic;
        TouchCollection touch;
        List<Planet> list;
        GameComponentCollection components;
        DrawableGameComponent player;

        int device_width = SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width;
        int device_height = SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height;


        public GamePage()
        {
            InitializeComponent();

            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;
            components = new GameComponentCollection();
            Planet planet = new Planet(new Game());
            components.Add()
            // Create a timer for this page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

        }
        

I need get the Game class how i make this ? thanks much much.

Where does the Game class come from in the DrawableGameComponent constructor?

I'm making a project to Windows Phone using Silverlight + XNA, but I don't know how I can use the DrawableGameComponent because the constructor requires a Game class, it looks like this:

Planet.cs

class Planet : DrawableGameComponent
{
    public Planet(Game game): base(game){
        
    {
}

but in my first page of Silverlight and XNA project not is a Game class it's this:

GamePage.xaml.cs

public partial class GamePage : PhoneApplicationPage
{
   ...
}
        

Where do I find the Game class to pass into the DrawableGameComponent constructor?

Source Link

Get the Game class on Silverlight+XNA project

i make a project to Windows Phone using Silverlight + XNA, but i dont can use the DrawableGameComponent because the constructor require a game Class, look how are:

Planet.cs

class Planet : DrawableGameComponent
{
      ...    
    
public Planet(Game game)
     : base(game){
        
{

but in my first page of silverlight+xna project not is a Game class is this:

GamePage.xaml.cs

public partial class GamePage : PhoneApplicationPage
    {
        ContentManager contentManager;
        GameTimer timer;
        SpriteBatch spriteBatch;
        GraphicsDevice graphic;
        TouchCollection touch;
        List<Planet> list;
        GameComponentCollection components;
        DrawableGameComponent player;

        int device_width = SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Width;
        int device_height = SharedGraphicsDeviceManager.Current.GraphicsDevice.Viewport.Height;


        public GamePage()
        {
            InitializeComponent();

            // Get the content manager from the application
            contentManager = (Application.Current as App).Content;
            components = new GameComponentCollection();
            Planet planet = new Planet(new Game());
            components.Add()
            // Create a timer for this page
            timer = new GameTimer();
            timer.UpdateInterval = TimeSpan.FromTicks(333333);
            timer.Update += OnUpdate;
            timer.Draw += OnDraw;

        }
        

I need get the Game class how i make this ? thanks much much.