예제 #1
0
        public void DrawText(I_WorldObject text)
        {
            Vector2 objPosInCameraSpace = text.getPosition();

            objPosInScreenSpace = objPosInCameraSpace;
            string texttowrite = parseText(text.getName());

            mSpriteBatch.DrawString(font, texttowrite, objPosInScreenSpace, Color.Black, text.getRotation(), text.getTextureOrigin(), 1.0f, SpriteEffects.None, 0);
        }
예제 #2
0
        public void Draw(I_WorldObject obj)
        {
            if (trackMe.getPosition().X >= WorldData.GetInstance().ScreenWidth / 2)
            {
                //Vector2 objPosInCameraSpace = obj.getPosition() - new Vector2((trackMe.getPosition()).X, 0);
                Vector2 objPosInCameraSpace = obj.getPosition() - new Vector2((trackMe.getPosition()).X - (WorldData.GetInstance().ScreenWidth / 2), 0);
                objPosInScreenSpace = objPosInCameraSpace;

                tracking = true;
            }
            else
            {
                tracking = false;
                Vector2 objPosInCameraSpace = obj.getPosition();
                objPosInScreenSpace = objPosInCameraSpace;
            }

            if (obj.getName() != "coin")
            {
                mSpriteBatch.Draw(obj.getTexture(), objPosInScreenSpace, null, obj.getColor(), obj.getRotation(), obj.getTextureOrigin(), 1.0f, SpriteEffects.None, 0);
            }
            else if (obj.getName() == "coin")
            {
                Rectangle srcRect = new Rectangle((int)obj.getFrame() * obj.getFrameWidth(), 0, obj.getFrameWidth(), obj.getTexture().Height);

                mSpriteBatch.Draw(obj.getTexture(), objPosInScreenSpace, srcRect, Color.White, obj.getRotation(), Vector2.Zero, obj.getScale(), SpriteEffects.None, 0);
            }
        }