1
\$\begingroup\$

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?

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

XNA + Silverlight projects no longer use the Game class nor do they use the DrawableGameComponent class.

A good article for migrating to XNA + Silverlight: http://xbox.create.msdn.com/en-US/education/catalog/article/migration_guide_moving_to_silverlight_xna

\$\endgroup\$
0
\$\begingroup\$

The DrawableGameComponent should be instanciated inside a Game class.

DrawableGameComponent dgc = new DrawableGameComponent(this);

As an alternative you could extend the DrawableGameComponent with a new one defining your own constructor, but it would lack of sense

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .