Esempio n. 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            if (gameTime.IsRunningSlowly)
            {
            }
            TouchCollection TC = TouchPanel.GetState();

            Vector2[] klikniecia = new Vector2[4];
            int       i          = 0;

            foreach (TouchLocation TL in TC)
            {
                if (TL.State == TouchLocationState.Moved)
                {
                    klikniecia[i++] = TL.Position;
                }
            }


            ParticleSystem.Pracuj();
            if (GlobalAcc.StanGry == GameState.Game)
            {
                Mapy.Pracuj(klikniecia, i);
            }


            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            deltaFPSTime += elapsed;
            if (deltaFPSTime > 1)
            {
                float fps = 1 / elapsed;
                iloscfps      = "<" + fps.ToString() + ">";
                deltaFPSTime -= 1;
            }


            base.Update(gameTime);
        }
Esempio n. 2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Menu.PrzyciskExit.Pojedyncze_wcisniecie)
            {
                this.Exit();
            }

            if (gameTime.IsRunningSlowly)
            {
            }
            TouchCollection TC = TouchPanel.GetState();

            Vector2[] klikniecia = new Vector2[4];
            int       i          = 0;

            foreach (TouchLocation TL in TC)
            {
                if (TL.State == TouchLocationState.Moved)
                {
                    klikniecia[i++] = TL.Position;
                }
            }


            ParticleSystem.Pracuj();
            if (GlobalAcc.StanGry == GameState.Game)
            {
                Mapy.Pracuj(klikniecia, i);
            }
            if (GlobalAcc.StanGry == GameState.Menu)
            {
                Menu.Pracuj(klikniecia, i);
            }
            if (GlobalAcc.StanGry == GameState.Info)
            {
                Info.Pracuj(klikniecia, i);
            }
            if (GlobalAcc.StanGry == GameState.Help)
            {
                Help.Pracuj(klikniecia, i);
            }

            if (GlobalAcc.StanGry == GameState.ChangingToInfoFromMenuP1 || GlobalAcc.StanGry == GameState.ChangingToGameFromMenuP1 || GlobalAcc.StanGry == GameState.ChangingToHelpFromMenuP1)
            {
                Menu.PracujPrzejscieDo();
            }
            if (GlobalAcc.StanGry == GameState.ChangingToMenuFromInfoP2 || GlobalAcc.StanGry == GameState.ChangingToMenuFromGameP2 ||
                GlobalAcc.StanGry == GameState.ChangingToMenuFromHelpP2)
            {
                Menu.PracujPrzejscieZ();
            }

            if (GlobalAcc.StanGry == GameState.ChangingToInfoFromMenuP2)
            {
                Info.PracujPrzejscieZ();
            }
            if (GlobalAcc.StanGry == GameState.ChangingToHelpFromMenuP2)
            {
                Help.PracujPrzejscieZ();
            }

            if (GlobalAcc.StanGry == GameState.ChangingToMenuFromInfoP1)
            {
                Info.PracujPrzejscieDo();
            }
            if (GlobalAcc.StanGry == GameState.ChangingToMenuFromHelpP1)
            {
                Help.PracujPrzejscieDo();
            }
            if (GlobalAcc.StanGry == GameState.ChangingToGameFromMenuP2)
            {
                Mapy.PrzejscieZ();
            }


            float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

            deltaFPSTime += elapsed;
            if (deltaFPSTime > 1)
            {
                float fps = 1 / elapsed;
                iloscfps      = "<" + fps.ToString() + ">";
                deltaFPSTime -= 1;
            }


            base.Update(gameTime);
        }