public void drawPolygons(Matrix worldeffect,
                  Texture2D texture, VertexPositionTexture[] vertices, BlendState blendMode, Camera eye)
        {
            effect.View = eye.get_transformation();
            effect.World = worldeffect;
            effect.Texture = texture;

            m_samplerstate = new SamplerState();

            m_samplerstate.AddressU = TextureAddressMode.Wrap;
            m_samplerstate.AddressV = TextureAddressMode.Wrap;

            m_device.SamplerStates[0] = m_samplerstate;

            foreach (EffectPass pass in effect.CurrentTechnique.Passes)
            {
                pass.Apply();

            }
            m_device.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);
        }
        public override void Draw( SpriteBatch sprite_batch, Camera eye )
        {
            if ( eye.m_curr_target != null && eye.m_curr_target.m_body != null ) { eye.Update(); }
            sprite_batch.End();
            MouseState ms = Mouse.GetState();
            if ( !m_ninja.m_is_killed ) {
                // set the mousecontroller's field
                mouse_control.m_center = m_ninja.m_position;
            }

            //            m_background = GameScreen.m_background;
            //            Vector2 origin = new Vector2( m_background.Width,
            //                m_background.Height ) / 2;
            //            Color background_tint = Color.WhiteSmoke;

            //            if (m_background == Statics.get_texture("Art/speedup-RedSquarebackground"))
            //            {
            //                background_tint = new Color(70,255,255);
            //            }
            //            else if (m_background == Statics.get_texture("Art/speedup-IceClouds"))
            //            {
            //               background_tint = new Color(50,50,50);
            //            }
            //            else if ( m_background != TestWorld.ground_texture )
            //            {
            //                background_tint = new Color(120,120,120);
            //            }

            //           /* sprite_batch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend,
            //=======
            //            if ( m_background != TestWorld.ground_texture && m_background != Statics.get_texture( "Art/speedup-RedSquarebackground" ) ) {
            //                background_tint = new Color( 120, 120, 120 );
            //            }
            //            else if ( m_background == Statics.get_texture( "Art/speedup-RedSquarebackground" ) ) {
            //                background_tint = new Color( 70, 255, 255 );
            //            }
            //            else if ( m_background == Statics.get_texture( "Art/speedup-IceClouds" ) ) {
            //                background_tint = new Color( 50, 50, 100 );
            //            }
            //            sprite_batch.Begin( SpriteSortMode.BackToFront, BlendState.AlphaBlend,
            //>>>>>>> 0d56fc3fc89fef40509bd59baafb8122e2700b5f
            //                null,
            //                              null, null, null, eye.get_background_transformation() );
            //            {
            //                foreach ( GameObject tile in m_background_tiles ) {
            //                    tile.draw( sprite_batch, eye );
            //                }
            //            }

            //            sprite_batch.End();*/

            //            sprite_batch.Begin( SpriteSortMode.BackToFront, null,
            //                 SamplerState.LinearWrap,
            //                               null, null, null, eye.get_background_transformation() );

            //            sprite_batch.Draw( m_background,
            //               eye.m_camera_position - new Vector2( GameScreen.GAME_WIDTH * 6f,
            //               GameScreen.GAME_HEIGHT * 5f ),
            //               new Rectangle( (int)( eye.m_camera_position.X / 7 ),
            //               (int)( eye.m_camera_position.Y / 7 ),
            //               (int)( m_background.Width * 2.5 / eye.m_camera_zoom ),
            //                (int)( m_background.Height * 1 / eye.m_camera_zoom ) ),
            //               background_tint, 0, origin, 7f, 0, 0 );

            //            sprite_batch.End();

            //test camera control
            //zoom out when going fast
            //pans direction towards velocity
            if ( !m_ninja.m_is_dead ) {
                if ( !GameScreen.editor_mode && eye.m_curr_target is Ninja ) {

                    if ( m_ninja.m_speed > 110 ) {
                        eye.m_zoom_change = 0.2f;
                    }
                    else if ( m_ninja.m_speed < 80 && m_ninja.m_speed > 70 ) {
                        eye.m_zoom_change = 0.25f;
                    }
                    else if ( m_ninja.m_speed < 40 && m_ninja.m_speed > 20 ) {
                        eye.m_zoom_change = 0.3f;
                    }
                    else if ( m_ninja.m_speed < 0.001f ) {
                        eye.m_zoom_change = 0.45f;
                    }
                    else if ( m_ninja.m_speed < 0.0001f ) {
                        eye.m_zoom_change = 0.6f;
                    }
                }
            }

            sprite_batch.Begin( SpriteSortMode.Texture,
                BlendState.AlphaBlend,
                              null, null, null, null,
                              eye.get_transformation() );

            //Draws all the GameObjects
            base.Draw( sprite_batch, eye );

            sprite_batch.End();

            sprite_batch.Begin( SpriteSortMode.BackToFront,
              BlendState.Additive, null, null, null, null,
              eye.get_transformation() );

            // Draw the photon trail
            m_ninja.m_speed_trail.draw( sprite_batch, eye );
            m_ninja.m_sonicboom.Draw( sprite_batch, eye );

            sprite_batch.End();

            sprite_batch.Begin();
        }