Esempio n. 1
0
        public World(Game1 game, IWorldLoader worldLoader)
        {
            this.Game = game;
            this._wl = worldLoader;
            // Create a new content manager to load content used just by this World.
            this._contentManager = new ContentManager(game.Services, "Content");

            var gameItems = worldLoader.GetGameObjects(this).ToList();
            this.GameObjects = new GameObjectCollection(worldLoader.Width, worldLoader.Height, gameItems);
            this.Player = gameItems.OfType<Player>().Single();

            this._itemsToDrawByZOrder = new List<StaticItem>[10];
            for (int i = 0; i < this._itemsToDrawByZOrder.GetLength(0); i++)
                this._itemsToDrawByZOrder[i] = new List<StaticItem>();
        }
Esempio n. 2
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static int Main(string[] args)
 {
     int result;
     try
         {
         var playerInput = new PlayerInput();
         var wl = new WorldLoader();
         using (var game = new Game1(playerInput, wl))
             {
             game.Run();
             }
         result = 0;
         }
     catch (ApplicationException e)
         {
         MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
         result = 1;
         }
     return result;
 }
Esempio n. 3
0
 public GameInput(Game1 game)
     : base(game)
 {
     game.Components.Add(this);
 }