예제 #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();
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
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();
            }
        }
예제 #7
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
        }
예제 #8
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);
        }
예제 #9
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);
        }
예제 #10
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);
            }
        }