Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            Game1.sSpriteBatch = new SpriteBatch(GraphicsDevice);

            // Define Camera Window Bounds
            Camera.SetCameraWindow(new Vector2(10f, 20f), 100f);

            // Create the primitives
            mUWBLogo = new TexturedPrimitive("UWB-PNG", new Vector2(30, 30), new Vector2(20, 20));
            mBall    = new SoccerBall(mSoccerPosition, mSoccerBallRadius * 2f);
        }
Пример #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 (InputWrapper.Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            #region Control the UWB Logo position with left thumb stick
            mUWBLogo.Update(InputWrapper.ThumbSticks.Left, Vector2.Zero);
            #endregion

            #region Let the SoccerBall update itself, and let user control its size with the right thumb stick
            mBall.Update();
            mBall.Update(Vector2.Zero, InputWrapper.ThumbSticks.Right);

            if (InputWrapper.Buttons.A == ButtonState.Pressed)
            {
                mBall = new SoccerBall(mSoccerPosition, mSoccerBallRadius * 2f);
            }
            #endregion

            base.Update(gameTime);
        }