Ejemplo n.º 1
0
 /// <summary>
 /// Constructor del estado de juego
 /// </summary>
 /// <param name="game">Juego</param>
 public State(Game game)
 {
     this.game = game;
     stateManager = game.Services.GetService(typeof(StateManager)) as StateManager;
     content = game.Services.GetService(typeof(ContentManager)) as ContentManager;
     graphics = game.Services.GetService(typeof(IGraphicsDeviceManager)) as GraphicsDeviceManager;
 }
Ejemplo n.º 2
0
        //  GraphicsDevice device;
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;
            graphics.ApplyChanges();

            //Creamos y añadido el ManagerState
            stateManager = new StateManager(this, Gameestados.IniMenu);
            Components.Add(stateManager);

            //Añadimos los servicios para poder usarlos en otras clases
               // device = GraphicsDevice;
               // Services.AddService(typeof(GraphicsDevice), device);
            Services.AddService(typeof(ContentManager), Content);
            Services.AddService(typeof(StateManager), stateManager);
        }