示例#1
0
文件: Engine.cs 项目: Ratstool/Zeds
        protected override void Initialize()
        {
            Textures.LoadTextures(this.Content);

            #region Camera
            Camera           = new Camera(Graphics.GraphicsDevice);
            CameraPosition.X = Graphics.PreferredBackBufferWidth * 1.0f / 2;
            CameraPosition.Y = Graphics.PreferredBackBufferHeight * 1.0f / 2;
            #endregion

            #region Screen Setup
            //ResolutionHandler.resolution = ResolutionHandler.Resolution.Three;

            //ToDo 3 Fix to draw background texture to fill all of the background
            MapSizeX = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            MapSizeY = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;

            SpriteBatch = new SpriteBatch(GraphicsDevice);

            Window.Title = "Zeds - Alpha " + versionNumber;
            #endregion

            #region Mouse
            IsMouseVisible     = false;
            MouseCoordinates.X = Graphics.PreferredBackBufferWidth * 1.0f / 2;
            MouseCoordinates.Y = Graphics.PreferredBackBufferWidth * 1.0f / 2;
            KeyBindings.PreviousScrollValue = 0;
            #endregion

            //Initial set up
            HQ.HQSetup();
            HumanNames.PopulateNamesLists();

            HumanSpawner.SpawnHumans();
            GrantStartingItems.PopulateItemList();

            #region Terrain
            GrassTufts.CreateGrassTufts();
            Bushes.CreateBushes();
            Trees.CreateTrees();
            Trees.CreateTreeFoliage();
            #endregion

            #region Build Menu
            BuildingPlacementHandler.SelectedStructure = BuildingSelected.None;

            PopulateBuildMenus.PopulateMenuIconList();
            BuildMenuPane.InitialiseBuildMenuLocation();
            BuildMenuPane.IsBuildMenuWindowVisible = true;
            BuildMenuRollOverText.UpdateRollOverTextPosition();
            #endregion

            DetailsPane.CreateDetailsPane(new Vector2((ScreenWidth / 2) - (Textures.DetailsWindowPane.Width / 2), 10), "");

            base.Initialize();

            ZedController.PopulateZedList();

            Grid.SetUpGrid();
        }