示例#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();
        }
示例#2
0
文件: Engine.cs 项目: Ratstool/Zeds
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            SpriteBatch.Begin(Camera);

            RenderBackground.DrawBackground();
            GrassTufts.DrawGrassTufts();
            Bushes.DrawBushes();

            DrawHumanPawns.DrawHumans();
            DrawZedPawns.DrawZeds();

            DrawStructures.DrawBuildings();
            RuinedBuilding.DrawRuinedBuildings();

            Trees.DrawTrees();
            Trees.DrawTreeFoliage();
            Resource.DrawGatherIcon();

            HealthBar.DrawHealthBar();


            //Build Menus
            if (BuildMenuPane.IsBuildMenuWindowVisible)
            {
                DrawBuildMenus.DrawBuildMenuPane();
                DrawBuildMenus.DrawMainMenuIcons();
            }

            if (BuildMenuPane.IsBuildMenuWindowVisible && BuildMenuInteraction.IsBuildMenuOpen)
            {
                DrawBuildMenus.DrawBuildMenuIcons();
            }

            if (BuildMenuRollOverText.IsBuildMenuRollOverTextVisible)
            {
                BuildMenuRollOverText.DrawRolloverText(BuildMenuRollOverText.RollOverTxt);
            }


            //Building Placement
            if (BuildingPlacementHandler.IsPlacingBuilding)
            {
                if (BuildingPlacementHandler.CheckIfGroundClear(Blueprint))
                {
                    SpriteBatch.Draw(BuildingPlacementHandler.SetBuildingTexture(), MouseCoordinates, Color.Green);
                }
                else
                {
                    SpriteBatch.Draw(BuildingPlacementHandler.SetBuildingTexture(), MouseCoordinates, Color.Red);
                }
            }


            //Pawn PawnInfoSB
            if (PawnInfo.IsPawnInfoVisible)
            {
                //PawnInfoMenuClose.ClosePawnInfoMenu();
                DrawPawnsInfoPanel.DrawPawnInfoPanel();
                SelectedPawn.DrawSelectedPawnIndicator();
            }
            if (ExtendIconChecks.IsWeaponIconListVisible)
            {
                DrawPawnInfoIcons.DrawWeaponListIcons();
            }


            //Pawn rollover text
            DrawDetailPane.DrawDetailsPane();
            if (DetailsPane.isDetailPaneVisible)
            {
                DrawDetailPane.DrawDetailsPaneText();
            }

            if (!Bulldozer.IsBulldozerActive)
            {
                Cursor.DrawCursor();
            }
            else
            {
                Cursor.DrawDozerCursor();
            }


            if (Zeds.Debug.Debug.IsDebugEnabled)
            {
                Zeds.Debug.Debug.DrawDebugInfo();
                fps.DrawFps();
            }

            SpriteBatch.End();

            base.Draw(gameTime);
        }