Example #1
0
        public static void Main(string[] args)
        {
            // Check if terminal container is not too small
            if (!ResolutionHandler.IsSupportedResolution())
            {
                throw new ApplicationException(
                          "The terminal window is too small. Please change window to the fullscreen mode.");
            }

            // Initialize player/villages instances
            Villages = new GameVillages();
            Player   = new Player(Villages.GetRandomVillage());

            // Initialize render pipeline
            RenderPipeline.Add(new PlayerStatsBar());

            // Display the welcome message (game instructions)
            WelcomeScreen.Display();

            // Display the main menu
            while (true)
            {
                /*
                 * // Constantly invoke main menu printing when thread is not busy
                 * // That way every task (other menu) can avoid memory recursion and
                 * // just skip the task, knowing that program will navigate user
                 * // to the main menu anyway.
                 */
                ActionGroupsMenu.Display();
            }
        }
Example #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            resolutionHandler = new ResolutionHandler(ref this.graphics, false);
            InputHandler.Initialize();
            ConfigurationManager.Config = new Configuration();

            base.Initialize();
        }
Example #3
0
        public static void Display()
        {
            // Clear the console
            FastGuiUtils.ClearConsole(true);

            // Create the breakline pipe
            // Initialize the string builder. We need a direct access to the char[]
            var breakLineBuilder = new StringBuilder(new string('═', ResolutionHandler.GetResolution(0)));

            // Change first and last char to the '*', for style purposes.
            breakLineBuilder[0]   = '╠';
            breakLineBuilder[^ 1] = '╣';
        public MenuHandler(ContentManager Content, GraphicsDevice graphicsDevice, MapHandlerScene mapHandler, PuzzleEngineAlpha.Level.TileMap tileMap, ResolutionHandler resolutionHandler, GameSceneDirector sceneDirector)
        {
            this.graphicsDevice = graphicsDevice;
            menuWindows         = new Dictionary <string, IScene>();
            menuWindows.Add("mainMenu", new MainMenu(Content, this, sceneDirector));
            menuWindows.Add("loadMap", new LoadMapMenu(graphicsDevice, Content, this, mapHandler, tileMap));
            menuWindows.Add("settings", new SettingsMenu(Content, this, resolutionHandler));

            activeWindow = menuWindows["mainMenu"];
            IsActive     = false;
            currentState = new MenuStateEnum();
            currentState = MenuStateEnum.Hidden;
            transition   = new PuzzleEngineAlpha.Animations.SmoothTransition(0.0f, 0.011f, 0.0f, 1.0f);

            this.camera = new PuzzleEngineAlpha.Camera.Camera(Vector2.Zero, new Vector2(ResolutionHandler.WindowWidth, ResolutionHandler.WindowHeight), new Vector2(ResolutionHandler.WindowWidth, PuzzleEngineAlpha.Resolution.ResolutionHandler.WindowHeight));
            camera.Zoom = transition.Value;
            ResolutionHandler.Changed += ResetSizes;
        }
Example #5
0
 public ApplyResolutionAction(ResolutionHandler resolutionHandler, DisplayMode displayMode)
 {
     this.resolutionHandler = resolutionHandler;
     this.displayMode       = displayMode;
 }
Example #6
0
        protected override void Update(GameTime gameTime)
        {
            Camera.Update(gameTime);

            /*
             * if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
             *  Keyboard.GetState().IsKeyDown(Keys.Escape))
             *  Exit();
             */

            // Mouse
            //ToDo 1 Fix mouse getting 'stuck' in fullscreen mode
            MouseCoordinates = Cursor.GetMouseCoordinates();
            Cursor.GetMouseCoordinates();
            Cursor.UpdateCursorRectangleLocation();

            //Update Tree Foliage Transparency
            Trees.ChangeTreeFoliageTransparency();


            if (Debug.Debug.IsDebugEnabled)
            {
                fps.Update(gameTime);
            }


            if (ResolutionChanged)
            {
                ResolutionHandler.SetResolution();
                Graphics.ApplyChanges();
            }


            Camera.Position = CameraPosition;


            #region User Interface

            if (BuildMenuPane.IsBuildMenuWindowVisible)
            {
                BuildMenuRollOverText.GenerateRollOverText();
                BuildMenuPane.CloseBuildMenu();
            }


            if (BuildingPlacementHandler.IsPlacingBuilding)
            {
                BuildingPlacementHandler.CheckIfGroundClear(Blueprint);
                BuildingPlacementHandler.PlaceAStructure(BuildingPlacementHandler.SetBuildingTexture());
            }


            //Menu
            if (!Bulldozer.IsBulldozerActive)
            {
                BuildMenuInteraction.CheckCursorMenuInteraction(Cursor.CursorRectangle);
            }

            if (BuildMenuInteraction.IsBuildMenuOpen && !Bulldozer.IsBulldozerActive)
            {
                BuildMenuInteraction.CheckBuildIconInteraction();
            }

            if (BuildMenuPane.IsBuildMenuWindowVisible && !Bulldozer.IsBulldozerActive)
            {
                BuildMenuPane.UpdateBuildMenuWindowLocation();
            }


            // Details Pane
            DetailsPaneInteraction.CheckForDetailsPaneInteraction();
            DetailsPaneMovement.UpdateDetailsPaneLocation();

            // Selected Pawn
            if (SelectedPawn.SelectedHuman != null)
            {
                SelectedPawn.UpdateIndicator(SelectedPawn.SelectedHuman);
                ExtendIconChecks.CheckExtendHandClicked();
                PawnInfo.UpdatePawnInfo();
            }
            #endregion

            #region PawnInfoSB
            PawnCursorInteraction.CheckForCursorPawnInteraction();

            if (PawnInfo.IsPawnInfoVisible)
            {
                PawnInfo.ClosePawnInfo();
            }

            if (ExtendIconChecks.IsWeaponIconListVisible)
            {
                EquipWeapon.CheckWeaponIconInteraction();
                CreateItemIcons.UpdateWeaponIconList();
            }

            #endregion

            ZedDeath.CheckZedsHealth();
            RuinedBuilding.CheckBuildingsHealth();
            HumanDeath.CheckHumansHealth();

            ZedController.IncreaseZeds();


            //Building Removal
            if (Bulldozer.IsBulldozerActive)
            {
                Bulldozer.DemolishStructure();
            }

            //Movement
            //HumanMovement.RunFromZeds();
            PathFind.MovePawns();


            CheckMouseStateChange.UpdateMouseState();
            KeyBindings.CheckForKeyInput();
            KeyBindings.CheckForMouseInput();

            Resource.SetResourcesForGathering();


            base.Update(gameTime);
        }