예제 #1
0
        /// <summary>
        /// Overrides the GameObject Draw() function. Here we need to define
        /// the source rectangle (rectangle within the sprite sheet)
        /// </summary>
        public override void Draw()
        {
            // Define location and size of the texture
            Rectangle destRect = Camera.ComputePixelRectangle(Position, Size);

            int imageTop  = mCurrentRow * mSpriteImageWidth;
            int imageLeft = mCurrentColumn * mSpriteImageHeight;
            // Define the area to draw from the spriteSheet
            Rectangle srcRect = new Rectangle(
                imageLeft + mPaddings,
                imageTop + mPaddings,
                mSpriteImageWidth, mSpriteImageHeight);

            // Define the rotation origin
            Vector2 org = new Vector2(mSpriteImageWidth / 2, mSpriteImageHeight / 2);

            // Draw the texture
            Game1.sSpriteBatch.Draw(mImage,
                                    destRect,     // Area to be drawn in pixel space
                                    srcRect,      // <<-- rect on the spriteSheet
                                    Color.White,  //
                                    mRotateAngle, // Angle to rotate (clockwise)
                                    org,          // Image reference position
                                    SpriteEffects.None, 0f);

            if (null != Label)
            {
                FontSupport.PrintStatusAt(Position, Label, LabelColor);
            }
        }
예제 #2
0
        public void Draw()
        {
            for (int i = 0; i < mTheFloorSet.Count; i++)
            {
                mTheFloorSet[i].Draw();
            }

            mTheSign.Draw();
            String msg = (mTheSign.Position.X / 20).ToString() + "m";

            FontSupport.PrintStatusAt(mTheSign.Position, msg, Color.Black);

            for (int i = 0; i < mTheSeaweedTallSet.Count; i++)
            {
                mTheSeaweedTallSet[i].Draw();
            }

            for (int i = 0; i < mTheSeaweedSmallSet.Count; i++)
            {
                mTheSeaweedSmallSet[i].Draw();
            }

            mEnemies.DrawSet();
            mFishFood.Draw();
        }
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public void DrawGame()
        {
            switch (mCurrentGameState)
            {
            case GameStates.StartScreen:
                if (mSplashScreen != null)
                {
                    mSplashScreen.Draw();
                }
                break;

            case GameStates.Playing:
                mEnvironment.Draw();
                mHero.Draw();
                FontSupport.PrintStatus("Distance: " + mDistantTraveled + "  Size: " + mHero.HeroSize, null);
                break;

            case GameStates.Dead:
                if (mGameOverScreen != null)
                {
                    mGameOverScreen.Draw();
                }
                break;
            }
        }
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public void DrawGame()
        {
            mHero.Draw();
            mArrow.Draw();

            FontSupport.PrintStatus("Arrow State: " + mArrow.ArrowState.ToString(), null);
        }
예제 #5
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary
        public void DrawGame()
        {
            mBall.Draw();
            FontSupport.PrintStatusAt(mBall.Position, mBall.RotateAngleInRadin.ToString(), Color.Red);

            mUWBLogo.Draw();
            FontSupport.PrintStatusAt(mUWBLogo.Position, mUWBLogo.Position.ToString(), Color.Black);

            FontSupport.PrintStatus("A-Soccer B-logo Left Thumb:move RightThumb:Scale X/Y:Rotate", null);
        }
예제 #6
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        public void DrawGame()
        {
            mRocket.Draw();
            mArrow.Draw();

            //print out text message to echo status
            FontSupport.PrintStatus("Rocket Speed(LeftThumb-Y)=" + mRocket.Speed + "  VelocityDirection(RightThumb-X):" + mRocket.VelocityDirection, null);

            FontSupport.PrintStatusAt(mRocket.Position, mRocket.Position.ToString(), Color.White);
        }
예제 #7
0
파일: GameState.cs 프로젝트: Metlina/dev
 /// <summary>
 /// This is called when the game should draw itself.
 /// </summary>
 public void DrawGame()
 {
     mRocket.Draw();
     mArrow.Draw();
     if (mChaser.HasValidTarget)
     {
         mChaser.Draw();
     }
     //print out text message to echo status
     FontSupport.PrintStatus("Chaser hit=" + mChaserHit + " Missed=" + mChaserMissed, null);
 }
예제 #8
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary
        public void DrawGame()
        {
            mBall.Draw();
            FontSupport.PrintStatusAt(mBall.Position, mBall.RotateAngleInRadian.ToString(), Color.Red);

            mUWBLogo.Draw();
            FontSupport.PrintStatusAt(mUWBLogo.Position, mUWBLogo.Position.ToString(), Color.Black);

            // Print out text message to echo status
            FontSupport.PrintStatus("A-Soccer B-Logo LeftThumb:Move RightThumb:Scale X/Y:Rotate", null);
        }
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public void DrawGame()
        {
            mFlower.Draw();
            foreach (var p in mPlane)
            {
                p.Draw();
            }
            mHero.Draw();

            FontSupport.PrintStatus("Collisions Bound(" +
                                    mHeroBoundCollision + ") Pixel(" +
                                    mHeroPixelCollision + ")", null);
        }
예제 #10
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        public void DrawGame()
        {
            mLargeFlower.Draw();
            mSmallTarget.Draw();

            // Print out text messsage to echo status
            FontSupport.PrintStatus("Primitive Collide=" + mPrimitiveCollide + "   PixelCollide=" + mPixelCollide, null);
            FontSupport.PrintStatusAt(mSmallTarget.Position, mSmallTarget.Position.ToString(), Color.Red);

            if (mPixelCollide)
            {
                mCollidePosition.Draw();
            }
        }
예제 #11
0
파일: ShowVector.cs 프로젝트: Metlina/dev
        /// <summary>
        /// Draws the arrow image extending from "from" along the "dir" direction
        /// </summary>
        /// <param name="from">beginning position of the vector</param>
        /// <param name="dir">the direction of the vector</param>
        static public void DrawPointVector(Vector2 from, Vector2 dir)
        {
            LoadImage();

            #region Step 4b. Compute the angle to rotate
            float length = dir.Length();

            float theta = 0f;

            if (length > 0.001f)
            {
                dir  /= length;
                theta = (float)Math.Acos((double)dir.X);
                if (dir.X < 0.0f)
                {
                    if (dir.Y > 0.0f)
                    {
                        theta = -theta;
                    }
                }
                else
                {
                    if (dir.Y > 0.0f)
                    {
                        theta = -theta;
                    }
                }
            }
            #endregion

            #region Step 4c. Draw Arrow
            // Define location and size of the texture
            Vector2   size     = new Vector2(length, kLenToWidthRatio * length);
            Rectangle destRect = Camera.ComputePixelRectangle(from, size);

            // destRect is computed with respect to the "from" position, on the left-side of the texture
            // we only need to offset the reference in the y from top-left to middle-left
            Vector2 org = new Vector2(0f, ShowVector.sImage.Height / 2f);

            Game1.sSpriteBatch.Draw(ShowVector.sImage, destRect, null, Color.White,
                                    theta, org, SpriteEffects.None, 0f);
            #endregion

            #region Step 4d. Print status message
            String msg;
            msg = "Direction=" + dir + "\nSize=" + length;
            FontSupport.PrintStatusAt(from + new Vector2(2, 5), msg, Color.White);
            #endregion
        }
예제 #12
0
        /// <summary>
        /// Draws the game state
        /// </summary>
        public void DrawGame()
        {
            mRocket.Draw();
            if (mNetInFlight)
            {
                mNet.Draw();
            }

            if (mInsectPreset)
            {
                mInsect.Draw();
            }

            //print out text message to echo status
            FontSupport.PrintStatus("Num insects netted = " + mNumInsectShot + " Num missed = " + mNumMissed, null);
        }
예제 #13
0
파일: Game1.cs 프로젝트: Metlina/dev
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            // Clear to background color
            GraphicsDevice.Clear(Color.CornflowerBlue);

            Game1.sSpriteBatch.Begin(); // Initialize drawing support

            mUWBLogo.Draw();
            mBall.Draw();

            //print out text message to echo status
            FontSupport.PrintStatus("Ball position:" + mBall.Position, null);
            FontSupport.PrintStatusAt(mUWBLogo.Position, mUWBLogo.Position.ToString(), Color.White);
            FontSupport.PrintStatusAt(mBall.Position, "Radius " + mBall.Radius, Color.Red);

            Game1.sSpriteBatch.End(); // Inform graphics system we are done drawing

            base.Draw(gameTime);
        }
예제 #14
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary
        public void DrawGame()
        {
            // Drawing the vectors
            Vector2 v = mPb.Position - mPa.Position;    // Vector V is from Pa to Pb

            // Draw Vector-V at Pa, and Px
            ShowVector.DrawFromTo(mPa.Position, mPb.Position);
            ShowVector.DrawPointVector(mPx.Position, v);

            // Draw VectorAtY at Py
            ShowVector.DrawPointVector(mPy.Position, mVectorAtPy);

            mPa.Draw();
            mPb.Draw();
            mPx.Draw();
            mPy.Draw();

            // Print out text message to echo status
            FontSupport.PrintStatus("Locator Positions: A=" + mPa.Position + "  B=" + mPb.Position, null);
        }
예제 #15
0
        /// <summary>
        /// Iterate through all visible game object and draw them
        /// </summary>
        public void DrawGame()
        {
            mHero.Draw();

            foreach (BasketBall b in mBBallList)
            {
                b.Draw();
            }

            if (null != mFinal)
            {
                mFinal.Draw();
            }

            // Drawn last to always show up on top
            FontSupport.PrintStatus("Status: " +
                                    "Score=" + mScore +
                                    " Basketball: Generated( " + mTotalBBallCreated +
                                    ") Collected(" + mBBallHit + ") Missed(" + mBBallMissed + ")", null);
        }
예제 #16
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public void DrawGame()
        {
            chao.Draw();
            Redes.Draw();
            mFlower.Draw();
            EntradaEdificio.Draw();
            foreach (var p in mPlane)
            {
                p.Draw();
            }
            mHero.Draw();

            if (mHeroPixelCollision)
            {
                mHeroTarget.Draw();
            }

            FontSupport.PrintStatus("Collisions Bound(" +
                                    mHeroBoundCollision + ") Pixel(" +
                                    mHeroPixelCollision + ")", null);
        }
예제 #17
0
파일: Game1.cs 프로젝트: Metlina/dev
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            // Clear to background color
            GraphicsDevice.Clear(Color.CornflowerBlue);

            Game1.sSpriteBatch.Begin(); // Initialize drawing support

            // Loop over and draw each primitive
            foreach (TexturedPrimitive p in mGraphicsObjects)
            {
                p.Draw();
            }

            //print out text message to echo status
            FontSupport.PrintStatus("Selected object is :" + mCurrentIndex + " Location=" + mGraphicsObjects[mCurrentIndex].Position, null);
            FontSupport.PrintStatusAt(mGraphicsObjects[mCurrentIndex].Position, "Selected", Color.Violet);

            Game1.sSpriteBatch.End(); // inform graphics system we are done drawing

            base.Draw(gameTime);
        }
예제 #18
0
        /// <summary>
        /// Draw the primitive
        /// </summary>
        virtual public void Draw()
        {
            // Define location and size of the texture
            Rectangle destRect = Camera.ComputePixelRectangle(Position, Size);

            // Define the rotation origin
            Vector2 org = new Vector2(mImage.Width / 2, mImage.Height / 2);

            // Draw the texture
            Game1.sSpriteBatch.Draw(mImage,
                                    destRect,     // Area to be drawn in pixel space
                                    null,         //
                                    Color.White,  //
                                    mRotateAngle, // Angle to rotate (clockwise)
                                    org,          // Image reference position
                                    SpriteEffects.None, 0f);

            if (null != Label)
            {
                FontSupport.PrintStatusAt(Position, Label, LabelColor);
            }
        }
예제 #19
0
 /// <summary>
 /// This is called when the game should draw itself.
 /// </summary>
 /// <param name="gameTime">Provides a snapshot of timing values.</param>
 public void DrawGame()
 {
     mHero.Draw();
     mEnemies.DrawSet();
     FontSupport.PrintStatus("Caught=" + mNumCaught.ToString(), null);
 }