Exemple #1
0
        protected override void Initialize()
        {
            /* FormSetUp */
            var screenScaleY = graphics.PreferredBackBufferHeight / 720.0f;
            var screenScaleX = graphics.PreferredBackBufferWidth / 1024.0f;

            screenXform     = Matrix.CreateScale(screenScaleX, screenScaleY, 1.0f);
            screenHeight    = graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Height;
            screenWidth     = graphics.GraphicsDevice.Adapter.CurrentDisplayMode.Width;
            Window.Position = new Point(screenWidth / 2 - windowWidth / 2, screenHeight / 2 - windowHeight / 2);

            Sprites.setSpriteBatch(new SpriteBatch(graphics.GraphicsDevice));
            GameItems.SetUp();

            world = Loader.LoadWorld(@".\cWorld\level1.world");
            hero  = new Hero();
            world.WorldUpdate(hero.Position);

            window = Content.Load <Texture2D>("Hud_Game");

            GameGUI.SetUp(hero);

            inputHandlerInventory = new InputHandler(1);
            inputHandlerMovements = new InputHandler();

            List <Monster> list = Loader.LoadKit <Monster>(@".\Content\Monsters.csv").ToList();

            monstersList = Creature.ToDictionary(list);
            foreach (var monster in monstersList.Values)
            {
                world.WorldUpdate(monster.Position);
            }
            base.Initialize();
        }